Laravel 5.4 – Resourceful Controllers With Model Boilerplate

In the previous posts I have covered two Laravel 5.4 features called “Laravel 5.4: Fluent Routing” and “Laravel 5.4: New middlewares – TrimStrings and ConvertEmptyStringsToNull. In this post I would like to write about a new --model flag, by using it you can create resourceful controllers with model boilerplate.

When generating a controller using artisan commands, we used to issue this command php artisan make:controller. Now from the 5.4 release, you can pass –model flag. For example, to generate a resourceful controller called postController issue below command, which will generate a resourceful controller that includes a boilerplate to inject the post model in the controller’s action.

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

0 0 vote
Article Rating
Notify of
Inline Feedbacks
View all comments Protection Status
Would love your thoughts, please comment.x