vytvoriť model s radičom laravel
php artisan make:controller CustomersController --model=Customer
spustite príkaz artisan z ovládača
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');
vytvoriť model s radičom laravel
php artisan make:model Customer
php artisan make:controller CustomersController --resource
vytvorenie modelu, kontroléra a migrácie v jedinom príkaze 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
použite príkaz php artisan prostredníctvom ovládača
<?php
Route::get('/foo', function () {
Artisan::queue('email:send', [
'user' => 1, '--queue' => 'default'
]);
//
});
urobiť model regulátor v jednom príkaze
# 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