Laravel How to store extra data/value in session Laravel

后端 未结 5 590
我寻月下人不归
我寻月下人不归 2021-01-20 23:11

I\'m using default auth() in laravel login (email & password) Now i try to take input from the user in text field like (Age or City)

Now i want to store (Age/City) i

5条回答
  •  孤城傲影
    2021-01-20 23:37

    You can use session() helper:

    session('age', 18); // saves age into session
    
    $age = session('age')`; // gets age from session
    

    Update

    If you want to save Age and City after user registration, you should store this data in a DB, not in a session. You can add some fileds in create method of app\Http\Controllers\Auth\AuthController.php

提交回复
热议问题