Several operation commands commonly used in Laravel database

Several commonly used operation commands:

1. Create a module: php artisan module:make <module-name>

php artisan module:make Admin

2. Create a data table:

php artisan make:migration create_posts_table --create=posts
 或 
php artisan module:make-migration create_posts_table Admin

注:表名称使用复数形式

3. Migrate data table:

php artisan migrate

4. Create a controller: php artisan module:make-controller <controller-name> <module-name>

php artisan module:make-controller Post Admin

5. Create a model: php artisan module:make-model <model-name> <module-name>

php artisan module:make-model Post Admin

6. Create a middleware: php artisan make:middleware <middleware-name> or php artisan module:make-middleware <middleware-name> <module-name>

php artisan make:middleware AdminAuth 
或
php artisan module:make-middleware AdminAuth Admin

7. Add user field file:

php artisan make:migration add_intro_to_users_table --table=users

Related documents:

"Laravel 6 Chinese Documentation" | Laravel China Community

Introduction | Laravel Modules Docs

Guess you like

Origin blog.csdn.net/weixin_43695488/article/details/125557413