laratrust
laratrust copied to clipboard
Laravel 8 jetstram Teams
Hello @santigarcor
Along with the laravel 8, jetstream package is introduced as default, to handle authentication functionality.
As I have seen, it brings teams functionality, which bring new variables on the table.
I would like to ask if you are aware of it and if you have thought any way to combine or separate the two teams (yours and jetstream) Models and functionality
@GeoSot I saw Taylor's talk about it, and to be honest I haven't thought about combining them. But it would be the way to go.
I believe some hacky solution(for now) would be to change all the Laratrust's configurations to use jetstream's teams table and model, but leaving the intermediate tables as they are.
@GeoSot I saw Taylor's talk about it, and to be honest I haven't thought about combining them. But it would be the way to go.
I believe some hacky solution(for now) would be to change all the Laratrust's configurations to use jetstream's teams table and model, but leaving the intermediate tables as they are.
Tried to this but got this error here:
Trait method Laratrust\Traits\LaratrustUserTrait::allTeams has not been applied as App\Models\User::allTeams, because of collision with Laravel\Jetstream\HasTeams::allTeams
so did this:
use LaratrustUserTrait {
LaratrustUserTrait::allTeams insteadof HasTeams;
}
Seems to be working so far.
Hi @santigarcor , I believe that I'm having some other error related to teams of jetstream.
While learning about laratrust and exactly on this point of the docs: https://laratrust.santigarcor.me/docs/6.x/usage/roles-and-permissions.html#assignment-2 , I'm receiving this error while testing it:
Well, the error is quite logic, but I'm afraid that the laratrust install didnt make the right modification on migrations, because this field doesnt exists on migration file...
If I create this field on role_user table, maybe the error go away but it's the right way to fix it?
Thanks
@GeoSot I saw Taylor's talk about it, and to be honest I haven't thought about combining them. But it would be the way to go. I believe some hacky solution(for now) would be to change all the Laratrust's configurations to use jetstream's teams table and model, but leaving the intermediate tables as they are.
Tried to this but got this error here:
Trait method Laratrust\Traits\LaratrustUserTrait::allTeams has not been applied as App\Models\User::allTeams, because of collision with Laravel\Jetstream\HasTeams::allTeams
so did this:
use LaratrustUserTrait { LaratrustUserTrait::allTeams insteadof HasTeams; }
Seems to be working so far.
Do you have an example of how you added laratrust support inline with jetstream teams? I was going to use spatie permissions but actually need laratrusts individual based user team permissions and hit a wall with the jetstreams clash.
To be honest, I kept laratrust for my simple projects, and for some demanding projects, I implemented a custom-made hybrid using fortify for authentication, and a combination of jetstream & laratrust for authorization 😞