Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Call to a member function middleware() on null

I use the following middleware in routing Laravel:

Route::group(['prefix' => 'api/'], function() {
    Route::resource('admin', 'adminController')->middleware('auth');
    Route::resource('profile', 'profileController')->middleware('role');
}); 

I get this error when i call 'admin' or 'profile' path in URL enter image description here

like image 462
ramzi trabelsi Avatar asked Dec 06 '22 14:12

ramzi trabelsi


1 Answers

Use this

Route::prefix("/dashboard")->middleware(['first','second'])->group(function(){
});
like image 116
Daniel Masih Avatar answered Jan 05 '23 15:01

Daniel Masih