Vivek Titwal Vivek Titwal -5 years ago 119
PHP Question

How to get an image on the desired page by clicking on that image using Laravel?

I am working on the laravel 5.0. I am getting an error: "trying to get property of non-object".I want to get an image on the desired page by clicking on that particular image. There are so many images on the page, i just want after clicking on any image, it will be appear on the desired page.
here is my code:

My Routes:

Route::get('/image/big/{id}' ,[

My controller:

public function bigimage($id){

return view('bigimage' , ['images'=>$images]);

My view from where i am calling the required Route:

@foreach($gallery->images as $image)
<a href="{{ URL('/image/big/'.$image->id) }}">
<img id="jumboimage2" src="{{ url($image->file_path) }}"></a>
<a href="{{ URL('/image/delete/'.$image->id) }}" id="margin">
<span id="margin" class="glyphicon glyphicon-remove-sign"></span></a>

My view where i want to get the required image:

<div class="row">
<section class="col-md-3">
@foreach($images as $image)

Answer Source
try this one out

$image = image::findOrFail($id);

return view('bigimage' , ['image' => $image])
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download