Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Purpose of session('status') in Laravel 5.5 view file?

Tags:

laravel-5.5

I'm new to Laravel, and after running php artisan make:auth, the associated home.blade.php file uses a call to check for and display session('status').

@extends('layouts.app')

@section('content')
<div class="container-fluid">
    <div class="card">
        <div class="card-header">Dashboard</div>

        <div class="card-body">
            @if (session('status'))
            <div class="alert alert-success">
                {{ session('status') }}
            </div>
            @endif

            You are logged in!
        </div>
    </div>
</div>
@endsection

Does this actually do anything? I've searched and drilled through many files and can't find out if this is actually used.

like image 514
Kyz Avatar asked Nov 02 '17 00:11

Kyz


People also ask

What is session (' status ') in Laravel?

Sessions are used to store information about the user across the requests. Laravel provides various drivers like file, cookie, apc, array, Memcached, Redis, and database to handle session data. By default, file driver is used because it is lightweight.

What is session and cookies in Laravel?

The session "driver" defines where session data will be stored for each request. Laravel ships with several great drivers out of the box: file - sessions will be stored in storage/framework/sessions . cookie - sessions will be stored in secure, encrypted cookies.

How can I see session variables in Laravel?

If you just want to see contents of session, try dd() : dd(session()->all()); If not, just use this to get all info: $data = session()->all();

Which one is correct to set a session data in Laravel?

The correct syntax for this is: Session::set('variableName', $value); For Laravel 5.4 and later, the correct method to use is put : Session::put('variableName', $value);


1 Answers

Inside Laravel's core files ( inside vendor )

vendor\laravel\framework\src\Illuminate\Foundation\Auth\ResetsPasswords.php

it is used.

Look for the function,

protected function sendResetResponse($response)

It returns the status with success string.

like image 88
Akshay Kulkarni Avatar answered Oct 12 '22 17:10

Akshay Kulkarni