crea modello con il controller laravel
php artisan make:controller CustomersController --model=Customer
esegui il comando artisan dal controller
If you have simple job to do you can do it from route file.
For example you want to clear cache. In terminal it would be php artisan
cache:clear In route file that would be:
\Artisan::call('cache:clear');
crea modello con il controller laravel
php artisan make:model Customer
php artisan make:controller CustomersController --resource
crea modello, controller e migrazione in un singolo comando laravel
php artisan make:model Products -mcr
-m, --migration Create a new migration file for the model.
-c, --controller Create a new controller for the model.
-r, --resource Indicates if the generated controller should be a resource controller
newer versions of laravel > 5.6
php artisan make:model Products -a
-a, --all Generate a migration, factory, and resource controller for the model
usa il comando php artisan attraverso il controller
<?php
Route::get('/foo', function () {
Artisan::queue('email:send', [
'user' => 1, '--queue' => 'default'
]);
//
});
crea il controller del modello in un singolo comando
# to make only Model Class
php artisan make:model Customer
# to make resource controller
php artisan make:controller CustomersController --resource
# make controller for already existing Model Class (binded to model)
php artisan make:controller CustomersController --model=Customer
# to make model, migration and controller all in one command
php artisan make:model User -mcr
# here m for migration, c for controller, r for resource methods in controller