danield2mind / laravel-locators
用于解耦Laravel 5.5.*中Controller和路由的请求结构
1.1.0
2018-01-17 17:55 UTC
Requires
- php: >=5.5.0
This package is not auto-updated.
Last update: 2024-09-20 02:13:31 UTC
README
用于解耦Laravel 5.5.*中Controller和路由的请求结构先决条件
安装
1 - 通过composer安装
composer require daniel2mind/laravel-locators
2 - 执行以下命令,使用"--force"更新RouteServiceProvider文件并发布其他文件
php artisan vendor:publish --force
完成!
为了测试,只需将测试路由添加到routes/web.php和routes/api.php中,如下所示
Route::get('locator', 'WebLocator@example'); //inserir em web.php Route::get('locator', 'ApiLocator@example'); //inserir em api.php
这样,访问Web路由(例如:localhost:8000/locator)将显示"The locator called with success!"。
访问API路由(例如:localhost:8000/api/locator)将返回一个包含状态码200的JSON,并显示消息"The locator called with success!"。