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.
I am Arjun from Hyderabad (India). I have been working as a software engineer from the last 7+ years, and it is my passion to learn new things and implement them as a practice. Aside from work, I like gardening and spending time with pets.