Home > OS >  Laravel, Route not defined. yet it is
Laravel, Route not defined. yet it is

Time:07-23

I'm developing an eccomerce site. and im getting this error on checkout. please help enter image description here

here are the defined routes:

//payfast payment

Route::get('payment', 'PaymentController@confirmpayment')->name('confirmPayment');
Route::get('/payfast/success','PaymentController@success')->name('payment.success');
Route::get('/payfast/cancel','PaymentController@cancel')->name('payment.cancel');

and here is the Controller (destination route):

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use NunoMaduro\Collision\Provider;
use App\Models\Cart;
use App\Models\Product;
use DB;
use Billow\Contracts\PaymentProcessor;






Class PaymentController extends Controller
{
    

    public function confirmpayment(PaymentProcessor $payfast)
    {
        $cart = Cart::where('user_id',auth()->user()->id)->where('order_id',null)->get()->toArray();
        
        $data = [];
        

CodePudding user response:

change your HTTP method from get to post like this: Route::post('payment', 'PaymentController@confirmpayment')->name('confirmPayment')

CodePudding user response:

it seems you don't have route named payment you only have

confirmPayment
payment.success
payment.cancel

CodePudding user response:

When you use Laravel Named Route name(), you have to use it.

Route::get('payment', 'PaymentController@confirmpayment')->name('confirmPayment');


Instead of using

payment

replace it with

confirmPayment
  • Related