TechRian
TechRian

Reputation: 3

Laravel 404 Error with parameter but without parameter it is working

Route::prefix('admin')->group(function () { Route::get('/editcategory/{$id}', [CategoryContoller::class, 'edit'])->whereNumber('id')->name('editcategory'); });

This Code gives me a 404 Not Found. But without parameter page is showing.

Upvotes: 0

Views: 344

Answers (2)

amirhosein hadi
amirhosein hadi

Reputation: 436

i think you most remove "$" from route

Route::get('/editcategory/{id}')

Upvotes: 0

MONSTEEEER
MONSTEEEER

Reputation: 580

Try to remove the $ in the parameter.

Route::prefix('admin')->group(function () { 
    Route::get('/editcategory/{id}', 
         [CategoryContoller::class, 'edit'])
                    ->whereNumber('id')->name('editcategory'); 
});

Upvotes: 0

Related Questions