Benubird
Benubird

Reputation: 19557

What is the difference between Session::set and Session::put in Laravel?

What is the difference between the Session::set and Session::put methods in Laravel? The docs only covers Session::put, but I have seen set used instead.

Upvotes: 9

Views: 6137

Answers (1)

Benubird
Benubird

Reputation: 19557

They are exactly the same. Session::put directly calls Session::set.

The only difference, is that Session::put allows you to pass it an array of [key => value] pairs, in which case it calls Session::set for each of them.

These methods are defined in Illuminate\Session\Store

Upvotes: 10

Related Questions