Reputation: 1179
I have this function
public function show($id)
{
echo $id;exit;
$restaurant = Restaurant::find($id);
return View::Make('restaurants.profile')->with('restaurant', $restaurant);
}
I call it like this:
http://localhost:8082/profjectname/public/restaurants/show/20
I got this error:
Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException
when I call it this way:
http://localhost:8082/ParkingProject/public/restaurants/show?id=3
it prints show
instead of 3
when I call it this way:
http://localhost:8082/ParkingProject/public/restaurants/testestestes?id=3
it prints testestestes
instead of 3
I have this :
Route::resource('restaurants', 'RestaurantsController');
the routes already works for other functions in the controller, so I don't thing the route has any error.
could you help me please
Upvotes: 1
Views: 132
Reputation: 7578
If you're using resource controller, there's no need to put the show
in your url, e.g.
http://localhost:8082/profjectname/public/restaurants/20
So for your resource controller restaurants
:
Verb Path Action Route Name
GET /restaurants index resource.index
GET /restaurants/create create resource.create
POST /restaurants store resource.store
GET /restaurants/{restaurant_id} show resource.show
Upvotes: 2