I'm building a site using Laravel 5.2. I have a function that simply changes one attribute of a user. It changes the "type" attribute from "individual" to "business". The function is simple and changes the database. It looks like this:
public function addBusiness() {
$user = Auth::user()->update([
'type' => 'business'
]);
Session::flash('msg_title', 'Awesome!');
Session::flash('message', 'You\'ve added a business to your account');
return redirect()->back();
}
If I display the attribute in the body it displays business as it should.
However, in the header (located in the layout app.blade.php file) it still shows "individual." I did a test where I had {{Auth::user()->type}} in both app.blade.php and my body blade file, it displayed "individual" in app.blade.php, and "business" in the body on the same screen.
It even persists after Session::flush(); after logout/login, or even login from another browser.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1PKqGM2
via IFTTT
Aucun commentaire:
Enregistrer un commentaire