简体   繁体   中英

Unable to create Controller and model in php laravel framework

I am new at php laravel framework.

how model and controller are created through composer? phr write the commands to create model and controller.

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.

To create a model just run in console
php artisan make:model <model name> (eg `php artisan make:model Test)

To create a controller
php artisan make:controller <controller name> (eg php artisan make:controller TestController )
You can also change a path where to create a new class:
php artisan make:controller NewFolder/Test

Try:

php artisan make:model Test -mcr

This command will create Model User, migration User, Controller User with resources.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM