單總結(jié)下目前掌握的artisan命令
模型與遷移文件
- 創(chuàng)建模型實(shí)例
php artisan make:model [modle_name]
- 創(chuàng)建模型實(shí)例順便生成一個(gè) [數(shù)據(jù)庫遷移]
php artisan make:model [modle_name] -m
生成的數(shù)據(jù)庫遷移文件名為:
(日期格式_create_[modle_name]_table.php)
-
創(chuàng)建遷移文件
php artisan make:migration [文件名] --create=[表名]
出現(xiàn)下圖錯(cuò)誤時(shí)春寿,刪除vendor\composer\autoload_static.php中的相關(guān)記錄就可以再次運(yùn)行創(chuàng)建命令
migrate_error.jpg 執(zhí)行遷移文件
php artisan migrate
導(dǎo)出表數(shù)據(jù)成seed文件與使用
- 導(dǎo)出指定表成seed文件
php artisan iseed [tablename]
php artisan iseed [tablename1],[tablename2]
php artisan iseed [tablename] --force(強(qiáng)制覆蓋)
- 使用seed填充已有seed文件數(shù)據(jù)
php artisan db:seed
- request文件創(chuàng)建
php artisan make:request [name] //默認(rèn)會(huì)創(chuàng)建在request文件夾下面
- storage軟連接
php artisan storage:link
- 不明白的命令可以在要使用的命令前面加help來查看有哪些參數(shù)
本文持續(xù)更新钾军,有時(shí)間就會(huì)來寫琅豆!