Reputation: 36
I am new at php laravel framework.
how model and controller are created through composer? phr write the commands to create model and controller.
Upvotes: 2
Views: 644
Reputation: 1916
You would use artisan not composer. To view all the commands you can run:
php artisan list
To make a controller and model you can run:
php artisan make:model -c Awesome
This will generate a Controller
named AwesomeController.php
file in your Http\Controllers\
directory. It will also generate a Model
named Awesome.php
in the App
directory by default.
Upvotes: 3
Reputation: 116
Try:
php artisan make:model Test -mcr
This command will create Model User, migration User, Controller User with resources.
Upvotes: 0
Reputation:
To create a model just run in console
php artisan make:model <model name>
(e. g. `php artisan make:model Test)
To create a controller
php artisan make:controller <controller name>
(e. g. php artisan make:controller TestController
)
You can also change a path where to create a new class:
php artisan make:controller NewFolder/Test
Upvotes: 2