vendredi 16 août 2019

Role and Attribution ID

I have an Admin which adds several recordings. Here, I have 2 formers.

enter image description here

The user Gofette can login and see his informations... enter image description here

Now, my problem is that the user 1 which is user Remace cannot login ??? I think ID 1 is reserved to admin only ?

Do you know how to solve that?

Here is an idea of my code:

public function index()
{   

  if($has_role = auth()->user()->hasRole('admin')){
       $formers = Former::oldest()->paginate(5);
       return view('admin.formers.index', compact('formers'));

  } else{
       $formers = Former::where('id', Auth::user()->id)->paginate(5);
       return view('admin.formers.indexx', compact('formers'));
        }

 }



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2Z9aAve
via IFTTT

Aucun commentaire:

Enregistrer un commentaire