Support the ongoing development of Laravel.io →
Authentication Database Eloquent
Last updated 2 years ago.
0

Fixed! I added a foreach loop on $ user-> roles () and then called the "name" field inside the foreach.

Last updated 2 years ago.
0

I have a query regarding Confide with Entrust.

My user controller looks something like

use Zizaco\Confide\ConfideUser;

use Zizaco\Confide\ConfideUserInterface;

use Zizaco\Entrust\HasRole;

class User extends Eloquent implements ConfideUserInterface

{

use ConfideUser;

use HasRole;

}

But when I call Confide::user() it doesn't give me roles.

means when I try to call

Confide::user()->hasRole('Author') it is not working for me. Do you have any idea how can I use this?

Last updated 2 years ago.
0

I don't have an answer for this as I am looking for a guide to use entrust myself. But I think this is your model not the controller, right?

By the way, I am very new to laravel and not very sure what is an ideal way to create roles, assign them etc. I mean where should I create role. Should I just create it once, or what should be the workflow for that. If there is any guide to that, I would be happy to explore.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

phroccon phroccon Joined 25 Jul 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.