Here is the link how to write code on this forum
https://help.github.com/articles/basic-writing-and-formatting-syntax/#quoting-code
hello every one i am new to laravel. i am trying to store db values in session and want to display whenever its needed. but i cant display all values of db.but its displaying only one value. please anybody can help me. here is my controlller code namespace App\Http\Controllers;
use Illuminate\Http\Request; use App\Http\Requests; use App\Customer; use App\Http\Controllers\Controller; use Session;
class SessionController extends Controller { public function accessSessionData(Request $req) { if($req->session()->has('first_name'))
echo $val=Session::get('first_name');
else echo 'No data in the session'; } public function storeSessionData(Request $request,$id)
{ $customers=Customer::where('first_name','LIKE','%'.$request->$id.'%')->get(); foreach($customers as $key =>$customer) { $request->session()->put('first_name',$customer->first_name); echo "Data has been added to session"; } } public function deleteSessionData(Request $request){ $request->session()->forget('first_name'); echo "Data has been removed from session."; } }
Please or to participate in this conversation.