phplaravelrouteslaravel-bladedefined

How can i solve this error named Route [delete-blog] not defined in my blade file?


I have route name named delete-blog but i got error named Route Not Defined. I ran route:clear , cache:clear , config:cache and view:clear but that didn't work. I changed route name but i got this error again.

how can i solve this problem ? Can you help me?

My route code :

Route::get('haber/sil/{id}', 'BlogDeleteController')->middleware('auth.custom')->name('delete-blog');

Solution

  • It is incorrect not to have function name in your route if you are not using resource Route but if you got Route not defined that is not the reason, otherwise you get Method not defined error.

    Check if you have your Route in route group where you have 'as' => '[something]...' parameter.

    Whatever reason it should be you must put function name in your route declaration:

     Route::get('haber/sil/{id}', 'BlogDeleteController@[Your delete Method Name Here]')->middleware('auth.custom')->name('delete-blog'); //put your function name