Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

snehakulal7's avatar

Session

Hello everyone,I am back with the new question.Please Can any one tell me how to use session for login page in laravel?

0 likes
4 replies
jlrdw's avatar
jlrdw
Best Answer
Level 75

That's what laravels authentication is for.

snehakulal7's avatar

Then how can i do session out for my web application?How can i set time for it?

jlrdw's avatar

Include the use statement:

use Illuminate\Support\Facades\Session;

And in the method where you need to set a session variable:

Session::put('dogsearch', $dogsearch);

to retrieve from session:

$myvar = Session::get('dogsearch');

But session is in the docs as well.

One place I use session is to build a redirect to a certain page:

return redirect('dog/indexadmin?p=' . Session::get('dogpage') . '&psch=' . Session::get('dogsearch') . '&aval=' . Session::get('dogaval'));

These are just examples.

Then how can i do session out for my web application?How can i set time for it?

Look in config\session.php

Please or to participate in this conversation.