首頁  >  文章  >  後端開發  >  總結php artisan module常用指令

總結php artisan module常用指令

藏色散人
藏色散人轉載
2021-02-03 15:37:403767瀏覽

總結php artisan module常用指令

module:make 建立一個新模組
module:use 使用模組(這允許執行其他指令時不用輸入模組名稱)
module:unuse 和上面相反
module:list 列出所有可用模組
module:migrate 執行某個模組的資料遷移(或所有模組的)
php artisan module:seed –class=TableSeeder Blog  填入資料
php artisan module:make-controller Admin/ReplyController Blog 建立控制器
php artisan module:make-request CreatePostRequest Blog 產生指定模組的給定請求##php artisan module:migrate-rollback Blog 執行模組的給定請求##php artisan module:migrate-回滾
php artisan module:migrate-refresh Blog 執行模組所有回滾後執行所有遷移
php artisan module:migrate-reset Blog 執行模組所有回滾
php artisan module:seed Blog 執行模組資料填充
php artisan module:publish-migration Blog 發布遷移
php artisan module:publish-config Blog 發布配置
php artisan module:publish-translation Blog 發布語言包
php artisan module:enable Blogmodule:enable Blogmodule:enable Blogmodule:enable Blogmodule:enable Blogmodule:enable Blogmodule:enable Blogmodule:enable Blogmodule:enable Blog開啟模組
php artisan module:disable Blog 關閉模組
php artisan module:update Blog 升級模組
















php artisan module:make-command CreatePostCommand Blog
php artisan module:make-migration create_posts_table Blog
php artisan module:make-seed seed_fake_blog_posts Blog#php artisan artisgake-seed seed_fake_blog_posts Blog#lerf; php artisan module:make-model Post Blog (可以使用-m同步產生遷移檔)
php artisan module:make-provider BlogServiceProvider Blog
php artisan module:make-middleware CanReadPostsMiddleware Blogware Blog
php artismodule:make-middleware CanReadPostsMiddleware Blogware Blogware Blogwarex make-mail SendWeeklyPostsEmail Blog
php artisan module:make-notification NotifyAdminOfNewComment Blog

php artisan module:make-listener NotifyUsersOfANewost Blog

php artis listmake module:make-listener NotifyUsersOfANewPost Blog –event=PostWasCreated –queuedphp artisan module:make-request CreatePostRequest Blogphp artisanmodule:make-event BlogPostWasUpdd.Postr artisan#ule:make-dm-FostWasUpdd.Postn.可以使用-sync產生同步任務)php artisan module:route-provider Blog 為指定的模組產生給定的路由服務提供者。 php artisan module:make-factory FactoryName Blog

php artisan module:make-policy PolicyName Blog

php artisan module:make-rule ValidationRule Blog
php artisan 程式:make-resource source:make-resource Blog #php artisan module:make-resource PostResource Blog –collection
php artisan module:make-test EloquentPostRepositoryTest Blog




#門面方法















## Module::all(); 取得所有模組
Module::getCached() 取得所有快取的模組
Module::getOrdered(); 取得排序後的所有模組(依照module.json檔案中的priority排序)
Module::scan(); 取得掃描過的模組
Module::find('name'); 查詢某個模組(傳回Module類別)

Module::get('name') ;###Module::findOrFail('module-name');###Module::getScanPaths(); 取得掃描的路徑###Module::toCollection(); 取得模組集合###Module::getByStatus (1); 依照狀態取得模組(1可用0不可用)###Module::has('blog'); 判斷模組是否存在###Module::allEnabled(); 取得所有可用模組###Module ::allDisabled();###Module::count(); 統計模組數量###Module::getPath(); 取得模組路徑###Module::register(); 註冊模組###Module:: boot(); 初始化模組###Module::collections(); 取得所有可用模組的集合###Module::getModulePath('name'); 取得某個模組路徑###Module::assetPath('name '); 取得某個模組的資源路徑###Module::config('composer.vendor'); 從這個套件取得設定值。 ###Module::getUsedStoragePath(); 取得使用的儲存路徑。 ###Module::getUsedNow(); 取得cli會話正在使用的模組。 ###Module::getUsed();###Module::setUsed('name'); 設定會話使用的模組###Module::asset('blog:img/logo.img'); 從某個模組取得資源路徑###Module::install('nwidart/hello'); 根據給定的模組名稱安裝指定的模組。 ###Module::update(‘hello’); 更新指定模組的依賴項。 ###

以上是總結php artisan module常用指令的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:learnku.com。如有侵權,請聯絡admin@php.cn刪除