mercredi 27 mars 2019

Getting a Forbidden when trying to access my controller

I've created a form that when submitted it needs to go to a controller function.

At the moment when I'm submitting my form I keep getting

Forbidden

You don't have permission to access /client_area/shop/payment-gateway on this server.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

I've done forms before but this is the first time this has happened to me and it has me stumped.

my form

<div class="payment-form">
    <form action="" method="POST">
        @csrf

        <input type="hidden" name="return_url" value="">
        <input type="hidden" name="cancel_url" value=""> 
        <input type="hidden" name="m_payment_id" value="">
        <input type="hidden" name="amount" class="completePrice" value="">
        <input type="hidden" name="item_name" value="Test Item">
        <input type="hidden" name="item_description" value="A test product">

        <input type="hidden" name="delivery_collection" class="delivery_collection" value="">
        <input type="hidden" name="delivery_fee" class="delivery_fee" value="">
        <input type="hidden" name="delivery_address" class="delivery_address" value="">

        <button type="submit" class="btn btn-success float-right confirm-order">
            Confirm Order
        </button>
    </form>
</div>

my routes

Route::group(['middleware' => ['web', 'auth']], function(){
    Route::get('/account/dashboard', 'UsersController@accountDashboard')->name('account.dashboard');
    Route::get('/account/details', 'UsersController@personalDetails')->name('account.details');
    Route::get('/account/track-orders', 'UsersController@trackOrders')->name('account.track-orders');
    Route::get('/account/invoices', 'UsersController@invoices')->name('account.invoices');
    Route::get('/account/address', 'UsersController@addressesIndex')->name('account.addresses.index');
    Route::get('/account/sort-orders', 'UsersController@sortOrders')->name('account.sort-orders');
    Route::get('/account/order-details/{invoice_number}', 'UsersController@orderDetails')->name('account.order-details');
    Route::get('/account/invoice-pdf/{id}', 'UsersController@invoicesPdf')->name('account.invoices.pdf');
    Route::get('/account/create-address', 'UsersController@createAddress')->name('account.create.address');
    Route::get('/account/edit-address/{id}', 'UsersController@editAddress')->name('account.edit.address');
    Route::get('/delivery-confirmation', 'PublicController@deliveryConfirmation')->name('cart.deliveryConfirmation');
    Route::get('/account/edit-delivery-address/{id}', 'UsersController@editDeliveryAddress')->name('account.edit.delivery.address');
    Route::get('/payment-success', 'PublicController@successPayment')->name('payment.success');
    Route::get('/payment-cancel', 'PublicController@cancelPayment')->name('payment.cancel');

    Route::post('/account/personal-details', 'UsersController@postPersonalDetails')->name('post.personal-details');
    Route::post('/account/business-details', 'UsersController@postBusinessDetails')->name('post.business-details');
    Route::post('/account/addresses-radio/{id}', 'UsersController@postAddressesRadio')->name('account.post.addresses.radio');
    Route::post('/account/create-address', 'UsersController@postAddress')->name('account.post.address');
    Route::post('/account/edit-address/{id}', 'UsersController@updateAddress')->name('account.update.address');
    Route::post('/payment-gateway', 'PublicController@paymentGateway')->name('payment.gateway');

    Route::delete('/account/delete-delivery-address/{id}', 'UsersController@deleteDeliveryAddress')->name('account.delete.delivery.address');
});

I've only done a dd() to make sure I hit the right function

public function paymentGateway()
{
    dd('this is a payment gateway');
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire