Timeline for Multi-User Roles in Laravel
Current License: CC BY-SA 3.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 3, 2015 at 14:17 | comment | added | AnotherGuy |
@user3758531 - I am afraid it has something to do with the Laravel framework, which isn't my strongest point, but you could try to force it into an array using return array_column((array) $this->roles, 'role'); . This should work if the returned object implements the ArrayAccess interface. Otherwise I am afraid I cannot help you
|
|
Jul 3, 2015 at 13:46 | comment | added | Jack |
I like the approach with the hasRole. It brings my Model from 3 methods to 1, which is why I accepted your answer. However, the array_column method did not work. When I call $this->roles it returns an object. Is there anything I can do for that?
|
|
Jul 3, 2015 at 13:40 | vote | accept | Jack | ||
Jul 3, 2015 at 10:40 | history | answered | AnotherGuy | CC BY-SA 3.0 |