当前位置:网站首页>Lavel PHP artisan automatically generates a complete set of model+migrate+controller commands
Lavel PHP artisan automatically generates a complete set of model+migrate+controller commands
2022-07-07 03:09:00 【Php_ XiaoZhi】
One 、 Common commands :
php artisan list see php artisan All commands
php artisan --help see php artisan Usage of
php artisan help admin:make see php artisan admin:make Usage of
php artisan admin:make --help see php artisan admin:make Usage of
Create controller
php artisan make:controller OrderController
establish Rest Style resource controller ( with index、create、store、edit、update、destroy、show Method )
php artisan make:controller OrderController --resource
Creating models
php artisan make:model Student
Create migration of new tables and migration of modified tables
php artisan make:migration create_orders_table --create=orders // Create order form ordersphp artisan make:migration add_tags_to_orders_table --table=orders// to orders Table increase tags Field
Perform the migration
php artisan migrate
When creating the model, the migration of the new table is generated at the same time + controller + route
php artisan make:model Order -m -c -r
Roll back the last migration
php artisan migrate:rollback
Roll back all migrations
php artisan migrate:reset
Create a fill
php artisan make:seeder OrderTableSeeder
Perform a single fill
php artisan db:seed --class=OrderTableSeeder
Perform all fill operations
php artisan db:seed
Create middleware (app/Http/Middleware Next )
php artisan make:middleware Activity
Create a queue ( database ) Table migration for ( Migration is required to take effect )
php artisan queue:table
Create queue class (app/jobs Next ):
php artisan make:job SendEmail
Create a request class (app/Http/Requests Next )
php artisan make:request CreateArticleRequest
Two 、 Usually a laravel The background management system construction process of the project , as follows
1、 download Laravel frame , install Laravel-admin Background management framework , Perform basic database connection configuration , Upload the configuration ,https/http Access mode, etc
2、Linux Under the server , Go to the root of the project , It can be used php artisan make Command create model + Data migration + controller .
3、 use php artisan admin:make Create a controller in the background , You can write scripts to create in batches . Then according to the business logic , Write controller content .
4、 Create a route for the controller in the background , You can write scripts to create in batches .
5、 Sign in Laravel-admin Background system , Set the corresponding menu .
3、 ... and 、Laravel Artisan The command of
Available commands:
| command | chinese | English |
|---|---|---|
| clear-compiled | Delete the compiled class file | Remove the compiled class file |
| down | Put the application in maintenance mode | Put the application into maintenance mode |
| dump-server | Start the dump server to collect dump information . | Start the dump server to collect dump information. |
| env | Display the current framework environment | Display the current framework environment |
| help | Displays help for the command | Displays help for a command |
| inspire | --- | Display an inspiring quote |
| list | List commands | Lists commands |
| migrate | Run database migration | Run the database migrations |
| optimize | Cache framework bootstrap file | Cache the framework bootstrap files |
| preset | Exchange front-end scaffolding for applications | Swap the front-end scaffolding for the application |
| serve | stay PHP Application development on the server | Serve the application on the PHP development server |
| tinker | Interact with your application | Interact with your application |
| up | Get the application out of maintenance mode | Bring the application out of maintenance mode |
app
| command | chinese | English |
|---|---|---|
| app:name | Set the application namespace | Set the application namespace |
auth
| command | chinese | English |
|---|---|---|
| auth:clear-resets | Refresh expired password reset token | Flush expired password reset tokens |
cache
| command | chinese | English |
|---|---|---|
| cache:clear | Refresh the application cache | Flush the application cache |
| cache:forget | Delete item from cache | Remove an item from the cache |
| cache:table | Create migration for cached database tables | Create a migration for the cache database table |
config
| command | chinese | English |
|---|---|---|
| config:cache | Create cache files to speed up configuration | Create a cache file for faster configuration loading |
| config:clear | Delete the configuration cache file | Remove the configuration cache file |
db
| command | chinese | English |
|---|---|---|
| db:seed | Fill the database | Seed the database with records |
event
| command | chinese | English |
|---|---|---|
| event:generate | Generate missing events and listeners based on registration | Generate the missing events and listeners based on registration |
key
| command | chinese | English |
|---|---|---|
| key:generate | Build applications key | Set the application key |
lang
| command | chinese | English |
|---|---|---|
| lang:publish | Publish language files to the resource directory | publish language files to resources directory. |
make
| command | chinese | English |
|---|---|---|
| make:auth | --- | Scaffold basic login and registration views and routes |
| make:channel | Create a new channel class | Create a new channel class |
| make:command | Create a new Artisan command | Create a new Artisan command |
| make:controller | Create a new controller class | Create a new controller class |
| make:event | --- | Create a new event class |
| make:exception | Create a new custom exception class | Create a new custom exception class |
| make:factory | Create a new model factory | Create a new model factory |
| make:job | Create a new working class | Create a new job class |
| make:listener | Create a new event listener class | Create a new event listener class |
| make:mail | Create a new email class | Create a new email class |
| make:middleware | Create a new middleware class | Create a new middleware class |
| make:migration | Create a new migration file | Create a new migration file |
| make:model | Create a new Eloquent Model class | Create a new Eloquent model class |
| make:notification | Create a new notification class | Create a new notification class |
| make:observer | Create a new Observer class | Create a new observer class |
| make:policy | Create a new policy class | Create a new policy class |
| make:provider | Create a new service provider class | Create a new service provider class |
| make:request | Create a new form request class | Create a new form request class |
| make:resource | Create a new resource | Create a new resource |
| make:rule | Create a new validation rule | Create a new validation rule |
| make:scaffold | Code generator — Laravel 5.x Scaffold Generator | Create a laralib scaffold |
| make:seeder | Create a new seeder class | Create a new seeder class |
| make:test | Create a new test class | Create a new test class |
migrate
| command | chinese | English |
|---|---|---|
| migrate:fresh | Delete all tables and rerun all migrations | Drop all tables and re-run all migrations |
| migrate:install | Create a migration Repository | Create the migration repository |
| migrate:refresh | Reset and rerun all migrations | Reset and re-run all migrations |
| migrate:reset | Roll back all database migrations | Rollback all database migrations |
| migrate:rollback | Rollback the last database migration | Rollback the last database migration |
| migrate:status | Displays the status of each migration | Show the status of each migration |
notifications
| command | chinese | English |
|---|---|---|
| notifications:table | Create a migration for the notification table | Create a migration for the notifications table |
optimize
| command | chinese | English |
|---|---|---|
| optimize:clear | Delete the cached bootstrap file | Remove the cached bootstrap files |
package
| command | chinese | English |
|---|---|---|
| package:discover | Rebuild cached package list | Rebuild the cached package manifest |
queue
| command | chinese | English |
|---|---|---|
| queue:failed | List all failed Queue work | List all of the failed queue jobs |
| queue:failed-table | by failed Queue work database table creation migration | Create a migration for the failed queue jobs database table |
| queue:flush | Refresh all failed Queue work | Flush all of the failed queue jobs |
| queue:forget | Delete failed Queue work | Delete a failed queue job |
| queue:listen | Listen to a given queue | Listen to a given queue |
| queue:restart | Restart the queue worker daemon after the current job | Restart queue worker daemons after their current job |
| queue:retry | retry failed Queue job | Retry a failed queue job |
| queue:table | Create a migration for the queue work database table | Create a migration for the queue jobs database table |
| queue:work | Start processing the work on the queue as a daemon | Start processing jobs on the queue as a daemon |
route
| command | chinese | English |
|---|---|---|
| route:cache | Create a route cache file to speed up route registration | Create a route cache file for faster route registration |
| route:clear | Delete route cache file | Remove the route cache file |
| route:list | List all registered routes | List all registered routes |
schedule
| command | chinese | English |
|---|---|---|
| schedule:run | Run the scheduled command | Run the scheduled commands |
session
| command | chinese | English |
|---|---|---|
| session:table | Create a migration for the session database table | Create a migration for the session database table |
storage
| command | chinese | English |
|---|---|---|
| storage:link | Create from “ public / Storage ” To “ Storage / application / public ” The symbolic link | Create a symbolic link from "public/storage" to "storage/app/public" |
vendor
| command | chinese | English |
|---|---|---|
| vendor:publish | Publish any releasable assets from the vendor package | Publish any publishable assets from vendor packages |
view
| command | chinese | English |
|---|---|---|
| view:cache | Compile all applications Blade Templates | Compile all of the application's Blade templates |
| view:clear | Clear all compiled view files | Clear all compiled view files |




Reproduced in :Laravel php artisan Automatic generation Model+Migrate+Controller The command of - Muyun stronghold - Blog Garden
边栏推荐
- MySQL is an optimization artifact to improve the efficiency of massive data query
- Oracle中日期的使用方法实例
- ERROR: Could not find a version that satisfies the requirement xxxxx (from versions: none)解决办法
- 掘金量化:通过history方法获取数据,和新浪财经,雪球同用等比复权因子。不同于同花顺
- 杰理之关于 DAC 输出功率问题【篇】
- Lingyun going to sea | yidiantianxia & Huawei cloud: promoting the globalization of Chinese e-commerce enterprise brands
- Contribution of Writing Series
- LeetCode 77:组合
- Matlb| economic scheduling with energy storage, opportunity constraints and robust optimization
- 杰理之FM 模式单声道或立体声选择设置【篇】
猜你喜欢

巴比特 | 元宇宙每日必读:IP授权是NFT的破圈之路吗?它的难点在哪里?Holder该如何选择合作平台?...

Redis入门完整教程:客户端案例分析

Qt蓝牙:QBluetoothDeviceInfo

tensorboard的使用

Don't you know the relationship between JSP and servlet?

【Socket】①Socket技术概述

杰理之在非蓝牙模式下,手机连接蓝牙不要跳回蓝牙模式处理方法【篇】

ERROR: Could not find a version that satisfies the requirement xxxxx (from versions: none)解决办法

PSINS中19维组合导航模块sinsgps详解(时间同步部分)

The 8 element positioning methods of selenium that you have to know are simple and practical
随机推荐
换个姿势做运维!GOPS 2022 · 深圳站精彩内容抢先看!
cocos3——8.实现初学者指南
Cglib agent in agent mode
Unity使用MaskableGraphic画一条带箭头的线
你知道电子招标最突出的5大好处有哪些吗?
Redis入門完整教程:問題定比特與優化
掘金量化:通过history方法获取数据,和新浪财经,雪球同用等比复权因子。不同于同花顺
Codeforces Round #264 (Div. 2) C Gargari and Bishops 【暴力】
[socket] ① overview of socket technology
【2022国赛模拟】多边形——计算几何、二分答案、倍增
Left path cloud recursion + dynamic planning
Leetcode 77: combination
c语言字符串排序
The annual salary of general test is 15W, and the annual salary of test and development is 30w+. What is the difference between the two?
Uniapp adaptation problem
Redis introduction complete tutorial: client case analysis
What are the characteristics of the operation and maintenance management system
杰理之FM 模式单声道或立体声选择设置【篇】
Classify the features of pictures with full connection +softmax
The first symposium on "quantum computing + application of financial technology" was successfully held in Beijing