Session throwing coding error on timeout instead of logging out/in
Hi,
If I refresh my application page after some time, it throws a programming error, when actually there is no programming problem.
(2/2) ErrorException
Trying to get property of non-object (View: /mnt/hd/www/portal/resources/views/viewstaffdetail.blade.php)
in 2327d988b16cbfaa488e385b4ea0a498ecf8de55.php (line 31)
at CompilerEngine->handleViewException(object(ErrorException), 1)
in PhpEngine.php (line 44)
at PhpEngine->evaluatePath('/mnt/hd/www/portal/storage/framework/views/2327d988b16cbfaa488e385b4ea0a498ecf8de55.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'data_entry' => null))
in CompilerEngine.php (line 59)
Please note: It works fine if I do the login again. But I have to go to login page manually (laravel does not send me there automatically).
It seems like a session timeout, but its weird. Firstly, it is happening too quickly (like in 2 minutes or lesser). Secondly, I have noticed that if I update the controller, then this happens for sure. Is this a normal behaviour (controller update), even though I am not touching anything related to the session code?
Lots of things use session without you probably realizing it. Auth, like @snapey said, as well as form validation errors get put in session, etc. and other things as well.
You can see the form errors in your message: 'errors' => object(ViewErrorBag)
So I have a STAFF model, a page to CREATE NEW STAFF, a second page which lists ALL CREATED STAFF, and a page to see the details of INDIVIDUAL STAFF. If I keep moving between first 2 pages (create/view all), it is fine. But if I go to see the details of any created staff, the detail page opens fine, but all other pages go whack. I cannot move back to create new staff or list all staff pages without forcibly logging in again.
use the route helper to generate all the links between pages, otherwise you can have problems with links being relative to the current request and not relative to the root