jeudi 28 juillet 2016

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}' ,[
  'uses'=>'GalleryController@bigimage',
  'as'=>'bigimage'
  ]);

My controller:

public function bigimage($id){

$images=image::findorFail($id);
return view('bigimage' , ['images'=>$images]);
}

My view from where i am calling the required Route:

 @foreach($gallery->images as $image)
  <li>
  <a href="">
  <img id="jumboimage2" src=""></a>
  </li>
  <li>
  <a href="" id="margin">
  <span id="margin" class="glyphicon glyphicon-remove-sign"></span></a>
  </li>
  @endforeach

My view where i want to get the required image:

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



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2a2yhws
via IFTTT

Aucun commentaire:

Enregistrer un commentaire