我想使用laravel
api
postman
获取事件,我在控制器EventController
中创建函数show
,我添加了route
,但它给了我错误404 Not Found
。并且我确信CCD_ 8的事件存在于CCD_。
路由/api.php
Route::get('/show/{id}', 'EventController@edit');
EventController.php
public function show($id)
{
$event = Event::find($id);
return $event;
}
网址:http://localhost/agendab/public/api/show/70
您正在对以下URL进行API调用:
http://localhost/agendab/public/api/show/70
但是,您定义的路由未配置为与该URL匹配。更新您的路线如下:
Route::get('/show/{id}', 'EventController@show');