How to add variable to session value in Laravel

658 views Asked by At

I have a Controller method that updates a record in the DB:

$brand_owner_relation = Relation::where('rel_brand_id',$id)->where('rel_is_active',0)->first();

$brand_owner_relation->rel_status_id = 10;
$brand_owner_relation->save();

return redirect()->back()->with('message',"Brand
       {{ $brand_owner_relation->brand_name }}
       is now active
");

Now the process of updating data is working fine but I need to show the Brand Name in the Blade as session.

So I tried :

return redirect()->back()->with('message',"Brand
       {{ $brand_owner_relation->brand_name }}
       is now active
");

but this is wrong cause it does not shows the brand name as session value...

So if you know how to show brand name as session value, please let me know.

1

There are 1 answers

0
Vaso Gamdelidze On
Session::set('brand_name' , $brand_owner_relation->brand_name);