samedi 30 juillet 2016

How to Route back with passing parameters using Laravel?

I am working on Laravel 5.0. I want to return back from my current page to the previous page with passing parameter. I have an id of all images and galleries in my urls. After clicking on a particular image, i move to another page with the id of that image in my url, Now, i want to return back to my gallery page to which that image belongs to.

My controller:

   public function viewgallerypics($id){
        $gallery= Gallery::findorFail($id);
        return view('dropzone' , ['gallery'=>$gallery]);
         }

    public function bigimage($id){
       $gallery=Gallery::all();
       $image=image::findorFail($id);
       return view('bigimage' , ['image'=>$image,'gallery'=>$gallery]);

       }

My routes:

       Route::get('/image/big/{id}' ,[
       'uses'=>'GalleryController@bigimage',
       'as'=>'bigimage'
       ]);


       Route::get('/gallery/view/{id}' ,[
       'uses'=>'GalleryController@viewgallerypics',
       'as'=>'viewpics'
       ]);

My view:

    <section class="col-md-1">
    <a class="btn btn-primary btn-lg" 
    href="HERE, WHAT I HAVE TO PASS TO GET MY DESIRED
    PAGE????">Back</a>
    </section>

My desired page where i want to return back depending on the id pass through the route:

 <div class="row">
 <div class="col-md-offset-1 col-md-10">
 <div  id="gallery-images">
 <ul>
 @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
 </ul>
 </div>
 </div>
 </div>



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

Aucun commentaire:

Enregistrer un commentaire