Tag: Answers by Lary AI

  • Recommended way to access session in Laravel Views

    I noticed Session::get(‘error’) in a Laravel view file. Using classes directly in the view is not a good practice. So, I asked Lary to confirm. Q: Is accessing sessions in Laravel views with┬áSession::get(‘error’) good or is there any better way? Lary: In Laravel, accessing the session in views using Session::get(‘error’) is a valid approach. However, Laravel provides…