laravel difference of session::flash and request->session->flash
Asked Answered
T

1

4

i wonder that what is the differences in performance and usage advantage ?

public function delete(){
    \Session::flash('success', __('common.message.success.delete'));
}

vs

public function delete(){
    $request->session()->flash('success', __('common.message.success.delete'))
}

please explain it with an open example. which one is the best performance provide and which one of the right way usage at session ?

Tragedian answered 15/5, 2017 at 12:11 Comment(0)
F
2

They are just different ways of accessing your application's session object. With laravel You can access application session

  1. Using session facade as Session::
  2. Using request's session method $request->session()

You can read on it here laravel docs for session. Hope it helps !

Funicular answered 15/5, 2017 at 13:26 Comment(1)
i read it before tons of but i did not find some information about performance. main goal is performance in here. thanks for your answerTragedian

© 2022 - 2024 — McMap. All rights reserved.