I have been looking in the docs for a solution to make views with basic CURD operations but without much success.
I guess this might be pretty simple, but am missing something or not looking hard enough.
i can make models and controllers using the below artisan commands
php artisan make:model modelName php artisan make:controller controllerName
But how do we make the basic CURD views. something like
php artisan make:views
cant find any doc for this. Please help
Artisan is the name of the command-line interface included with Laravel. It provides a number of helpful commands for your use while developing your application. It is driven by the powerful Symfony Console component.
Loading a view in the controller is easy. You just need to add `view('viewname')` method while returning from the controller method. `view()` is a global helper in Laravel. In this method, you just need to pass the name of the view.
Return data to view using route::view method in Laravel You can use Route::view() method in web. php file while defining the web route and return to view (passed as second agruments to route::view method) without any callback function with data which is passed as third arguments to route definition.
At the time of writing, there isn't a way to create views via artisan without writing your own command or using a third party package. You could write your own as already suggested or use sven/artisan-view.
if you are using laravel 5.1 or 5.2 this gist can help you make:view command just create command copy and paste the code from gist.
Step 1:
php artisan make:command MakeViewCommand
Step 2:
copy class from this gist
https://gist.github.com/umefarooq/ebc617dbf88260db1448
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With