Randy_Johnson
2 weeks ago

Redirecting an Error to a 404!

Posted 2 weeks ago by Randy_Johnson

Hi, when ever I leave the computer and the user is logged in, over a certain amount of time the user is logged out (of course, we all know, I'm sorry!). When this happens I refresh the page and I get the error:

Trying to get property 'is_admin' of non-object

The error isn't the problem, it is the showing of the error which I want to rid. I went into the code and tried putting an else statement as so:

@extends('layouts.app')
 
@section('content')

@if(auth()->user()->is_admin == 1)
    @include('admin.home')
@elseif(auth()->user()->is_admin == 0)
    @include('user.home')
@else 
    @include('home')
@endif

@endsection

Please help!

Please sign in or create an account to participate in this conversation.