Search
 
SCRIPT & CODE EXAMPLE
 

PHP

store multiple session in laravel

//store multipal data
Session::put('user', ['first_name' => $request->get('first_name'), 'user_role' => Auth::user()->user_role, 'city' => Auth::user()->city]);

//in blade template
<p>
  {{Session::get('user')['city']}}
</p>

@foreach (Session::get('user') as $user)
	{{$user}}
@endforeach

//condtion check
@if(Session::has('user'))
  @foreach (Session::get('user') as $user)
  	{{ $user }}
  @endforeach
@endif
// condition check using ternary operator
{{ (Session::has('user')) ? 45 : 55}}

//delete session
Session::forget('customer');
//@sujay
Comment

PREVIOUS NEXT
Code Example
Php :: store emoji in php 
Php :: where is the php ini file located on server 
Php :: static modal 
Php :: laravel 5.8 cors 
Php :: clear laravel.log 
Php :: define function parameters php 
Php :: php auto redirect 
Php :: php exec without waiting 
Php :: Fetch Data From Database With PDO 
Php :: sanctum auth check? 
Php :: laravel collection sum array column 
Php :: print hello world in php 
Php :: factorial function php 
Php :: laravel password encryption 
Php :: php unset reference 
Php :: paystack gateway integration laravel 
Php :: lodash tester 
Php :: symfony see all make command 
Php :: PHP str_starts_with — Checks if a string starts with a given substring 
Php :: php array sort by key value 
Php :: option selected in laravel blade 
Php :: yii2 gridview filter exact value 
Php :: remove first 4 characters in string php 
Php :: array constant in php 
Php :: full month name php 
Php :: with in laravel 
Php :: Merge Two Collection or Array 
Php :: 0 
Php :: laravel drop foreign key 
Php :: add custom page to wordpress 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =