i want to get event using laravel
api
postman
, i create function show
in the controller EventController
, i add route
but its give me error 404 Not Found
.
and I am sure that event whose id=70
exist in db
.
routes/api.php
Route::get('/show/{id}', 'EventController@edit');
EventController.php
public function show($id)
{
$event = Event::find($id);
return $event;
}
url : http://localhost/agendab/public/api/show/70
CodePudding user response:
You're making an API call to the following URL:
http://localhost/agendab/public/api/show/70
However, the route you have defined is not configured to match that URL. Update your route to as follows:
Route::get('/show/{id}', 'EventController@show');