Route还有这么一种用法,隐式控制器。
Route::controller('users', 'UserController');
namespace App\Http\Controllers;
class UserController extends Controller
{
/**
* 响应 GET /users 请求
*/
public function getIndex()
{
//
}
/**
* 响应 GET /users/show/1 请求
*/
public function getShow($id)
{
//
}
/**
* 响应 GET /users/admin-profile 请求
*/
public function getAdminProfile()
{
//
}
/**
* 响应 POST /users/profile 请求
*/
public function postProfile()
{
//
}
}
同时,还有一个路由缓存,可以提高访问速度。
php artisan route:cache
php artisan route:clear