Exception in Collection.php line 1543:

Asked

Viewed 62 times

0

Property [type] does not exist on this Collection instance.

I am doing a project in Laravel (5.4) where it is practically ready, however, this error is occurring, because I want the user to click to login, do not appear the view \home and yes enter that if/Else:

public function index()
{
    $user = Auth::user();

    if($user->tipo == 'Administrador'){
        return View('/inicioadm'); //aqui já tentei com redirect e tbm n foi
    }else{
        return View('/iniciodes'); //aqui já tentei com redirect e tbm n foi
    }
}

Routes:

Route::('home', 'Auth\HomeController@index');
Route::post('home', 'Auth\HomeController@index');
  • In $user->type, type is an attribute of the users table. You created this attribute?

  • What is this tipo? Would not be $user->role?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.