What do you want to save?
Add Code snippet
New code examples
-
PHP 2022-03-03 07:05:02
withErrors laravel
Inside controller : return back()->withError('You are not logged in or Your session has expired'); Inside blade file : @if(Session::has('errors')) toastr.error("{{Session::get('errors')->first()}}"); @endif It’s a “m... Add solution -
PHP 2022-03-01 03:25:12
recuperer des informations d'une table parent en sql
If you want to handle sessions with a class, I wrote this little class: <?php /* Use the static method getInstance to get the object. */ class Session { const SESSION_STARTED = TRUE; const SESSION_NOT_START... Add solution -
Other 2022-02-10 14:50:12
session flash
use Illuminate\Support\Facades\Session; Session::flash('message','This is a message!'); then in your view:: @if(Session::has('message')) <p class="alert {{ Session::get('alert-class', 'alert-info') }}">{{Session::get('message') }}<... Add solution -
PHP 2022-01-26 05:45:45
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>... Add solution -
PHP 2021-11-21 21:18:27
set session data in laravel
/** * Static method */ Session::put('key', $value); // Set session variable Session::get('key') // Get session variable /** * Instance method */ session(['key' => $value]); // Set session variable session('key'); // Get session variable Add solution -
PHP 2021-10-25 01:19:06
how to return with open model popup in laravel
//pass back a variable when redirecting return Redirect::back()->with('error_code', 5); //in blade tempalte @if(!empty(Session::get('error_code')) && Session::get('error_code') == 5) <script> $(function() { $('#myModal').modal('show'... Add solution -
PHP 2021-10-12 01:12:09
session variable in laravel
/** * Static method */ Session::put('key', $value); // Set session variable Session::get('key') // Get session variable /** * Instance method */ session(['key' => $value]); // Set session variable session('key'); // Get session variable Add solution -
PHP 2021-10-01 15:23:06
laravel controller return message
#In Controller use Session; Session::flash('message', "Special message goes here"); return Redirect::back(); #In View @if (Session::has('message')) <div class="alert alert-info">{{ Session::get('message') }}</div&g... Add solution