lundi 28 août 2017

Laravel to get db values from session id

I am trying to create a session and retrieve it and get db values using the session id

(i.e) While on click edit i like to store the data-id in session and from session id i like to retrieve the db values using Eloquent

so far i stored and retrieve the session the only problem i don't know to get db from that session id here is my following code

My ajax call :

    $(document).ready(function(){
        $('.editaction').click(function(){
            var editaction=($(this).attr("data-id"));
            console.log(editaction);
                $.ajaxSetup({
                    headers: {
                            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                        }
                });
         $.ajax({
            type:"POST",
              url:"/design_session",
              data:"design_id="+editaction,
              success:function(results){
                window.location.href="/design_edit";
              }
            }); 
        });
    })  

Db controller page :

public function show()
{
    $design_id = $request->session()->get('design_id');
    return view('pages.design_edit')->with('design',$design_id);
}  

so far i am getting redirect to another page successfully but i don't how to invoke or pass the ajax through the function to get db values



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

Aucun commentaire:

Enregistrer un commentaire