How can I check if this session is empty, here example
@elseif {{Session::get('package_id')}}=null
@include('index.customer.customerpackage')
and how to check if {{Session::get('package_id')}}=1 then Free else Paid
How can I check if this session is empty, here example
@elseif {{Session::get('package_id')}}=null
@include('index.customer.customerpackage')
and how to check if {{Session::get('package_id')}}=1 then Free else Paid
You can use
@elseif (session()->has('package_id'))
to verify if it's in session or in case it might be in session but also set to null, you can use:
@elseif (session()->get('package_id'))
@elseif (session('package_id'))?\Session::get('package_id')As of now Laravel 8.XX there are several ways:
To determine if an item is present in the session, you may use the has method. The has method returns true if the item is present and is not null.
if (session()->has('users')) {
//
}
To determine if an item is present in the session, even if its value is null, you may use the exists method.
if (session()->exists('users')) {
//
}
To determine if an item is not present in the session, you may use the missing method.
if (session()->missing('users')) {
//
}