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

javieralex's avatar

save variable and use it until logout

hello, from my view I send the id by get of a user profile to another view, the problem is that when changing view this variable is lost. Is there a way to store it in cookies or files and that it remains until I close the session? And if in a few words I start a session and it sends me the option to choose a profile and it sends me in an arrangement the profile data to another view.

So I send my id in my view

href= {{ route('/userviews/trainingp', ['idp'=> $profile->id_profile]) }}">

route

Route::middleware(['auth:sanctum', 'verified'])->get('/userviews/trainingp/', [App\Http\Controllers\ProfilesController::class, 'Sendid'], function () { return view('userviews/trainingp'); })->name('/userviews/trainingp');

Senddid

public function Sendid() { $v1=$_GET['idp'];

    $profile= Profile::where ('id_profile', '=',  [$v1])->get();
   
  
   
    return view('/userviews/trainingp')->with('profile', $profiles);



    
   
}

Thank you

0 likes
2 replies
sr57's avatar

Have a look to session variables.

Please or to participate in this conversation.