Reputation: 5772
When I click on a certain image, I send the user to :
<a href='/image/{{ $image->id }}'>
The route that handles this is:
Route::get('/image/{id}', 'PagesController@specificImage')->name('specificImage');
This function should get the information of the image with that id and pass it to a view. Unfortunately, I am not sure how to get the information of the image with id of $imageId
.
public function specificImage($id) {
$imageId = $id;
}
Upvotes: 2
Views: 157
Reputation: 25374
Actually, you don't even need to look it up if you use typehinting:
public function specificImage(Image $image){
// $image will now contain the image you're looking for
}
Upvotes: 1
Reputation: 9853
Assuming your model name for image
table is Image
-
$image = Image::find($imageId);
Upvotes: 1