title: How to pass session value in laravel 5.2
body: <p>I want to pass $var variable with session to a page . And want to receive this data. </p>
  
  <pre><code>public function check(Request $request)
  {
      $c_email = $request-&gt;email;
      $c_pass=$request-&gt;pass;
      $c_type=$request-&gt;select;
      //dd($Idpass);
     $var=DB::select("SELECT * FROM reg where email = '$c_email' and Password = '$c_pass' and type = '$c_type'");
     if ($var) {
         session_start();
         $request-&gt;session()-&gt;put('key', '$var');
       return redirect('farmer');
     }
     else {
      $msg="Invalid login";
      return view('index')-&gt;with('show',$msg);
     }
  }
  </code></pre>