📜  laravel 中的控制器类型 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:03.990000             🧑  作者: Mango

代码示例1
-types of controller:
    -basic controller
        -php artisan make:controller basicController
        -Route: Route::get('about',[basicController::class,'about']);
    -single action controller    (handle single action)
        public function __invoke(){//inbuilt}
        -php artisan make:controller singleActionController --invokable
        -Route::get('course',singleActionController::class); //it will invoke only one function
    -resource controller (CRUD functions)
        -Route::resource('photo',photoController::class);  //invoke index function