mardi 3 avril 2018

How can I custom Route::resource on the laravel?

If my routes like this :

Route::prefix('member')->middleware('auth')->group(function(){
    Route::prefix('purchase')->group(function(){
        Route::get('order', 'Member\PurchaseController@order')->name('member.purchase.order');
        Route::get('transaction', 'Member\PurchaseController@transaction')->name('member.purchase.transaction');
    });
    Route::resource('purchase', 'Member\PurchaseController');
});

If I call : http://my-app.test/member/purchase/1, it works. No error

But I change my routes like this :

Route::prefix('purchase')->group(function(){
    Route::get('order', 'Member\PurchaseController@order')->name('member.purchase.order');
    Route::get('transaction', 'Member\PurchaseController@transaction')->name('member.purchase.transaction');
    Route::resource('/', 'Member\PurchaseController');
});

If I call : http://my-app.test/member/purchase/1, there exist error like this :

Sorry, the page you are looking for could not be found.

How can I solve this error?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire