1. 程式人生 > >Laravel命令解析

Laravel命令解析

php artisan list make
---------------------------9
storage 一些快取
routers 四類路由
resources 模板等未編譯的前端檔案
public 專案入口檔案
bootstrap 框架載入檔案
configapp所有配置
database資料庫遷移目錄
make:migration Create a new migration file
tests 測試資料夾
make:test Create a new test class
make:seeder Create a new seeder class Laravel 可以用 seed 類輕鬆地為資料庫填充測試資料。
app


app目錄

Models
make:model Create a new Eloquent model class
php artisan make:model Models/Test

Services
業務邏輯
make:factory Create a new model factory
make:observer Create a new observer class
make:policy Create a new policy class

Broadcasting
目錄包含了應用所需的所有廣播頻道類
該目錄預設不存在
make:channel Create a new channel class

Console目錄
目錄包含應用所有自定義的 Artisan 命令
make:command Create a new Artisan command

Events目錄
event:generate 和 make:event
該目錄用於存放事件類
make:event Create a new event class

Exceptions目錄
Exceptions 目錄包含應用的異常處理器
自定義異常如何記錄或渲染,需要編輯該目錄下的 Handler 類
make:exception Create a new custom exception class

Http目錄
Http 目錄包含了控制器、中介軟體以及表單請求等,幾乎所有通過 Web 進入應用的請求處理都在這裡進行。
make:request Create a new form request class app/Http/Requests 目錄下
make:controller Create a new controller class app/Http/Controllers 目錄下
make:resource Create a new resource 建立一個資源轉化器 app/Http/Resources 目錄下
make:auth Scaffold basic login and registration views and routes app/Http/Controllers 目錄下 HomeController.php和一系列模板
make:middleware Create a new middleware class app/Http/Middleware 目錄下

Jobs目錄
目錄用於存放佇列任務
該目錄預設不存在
make:job Create a new job class

Listeners目錄
event:generate 和 make:listener
這個目錄預設不存在
目錄包含處理事件的類(事件監聽器)
make:listener Create a new event listener class

Mail目錄
這個目錄預設不存在
目錄包含應用所有郵件相關類
make:mail Create a new email class

Notifications目錄
Notifications 目錄包含應用傳送的所有通知
這個目錄預設不存在,
make:notification Create a new notification class

Policies目錄
這個目錄預設不存在
目錄包含了應用所有的授權策略類
make:policy

Providers目錄
目錄包含應用的所有服務提供者。
make:provider Create a new service provider class

Rules目錄
目錄包含應用的自定義驗證規則物件
該目錄預設不存在
make:rule Create a new validation rule