route-model-binding

Laravel 7 Route Model Binding is not working (Model in the route is always null)

半城伤御伤魂 提交于 2021-01-05 06:42:11
问题 I am working on a Laravel 7 project. In my project, I am doing the route model binding. But it is not working and the model in the route is always returning null. This is what I have done so far. I declare a route Route::put('restaurant-category/{category}', 'RestaurantCategoryController@update')->name('restaurant-category.update'); As you can see, there is a placeholder for model binding, {category}. This is my action in the controller. public function update(RestaurantCategory $category,

Laravel 7 Route Model Binding is not working (Model in the route is always null)

一个人想着一个人 提交于 2021-01-05 06:41:35
问题 I am working on a Laravel 7 project. In my project, I am doing the route model binding. But it is not working and the model in the route is always returning null. This is what I have done so far. I declare a route Route::put('restaurant-category/{category}', 'RestaurantCategoryController@update')->name('restaurant-category.update'); As you can see, there is a placeholder for model binding, {category}. This is my action in the controller. public function update(RestaurantCategory $category,