Replies: 1 comment
-
Hi! I need the same functionality. Did you find a solution? I think one possibility is to make team_foreign_key Schema::create($tableNames['model_has_roles'], static function (Blueprint $table) use ($tableNames, $columnNames, $pivotRole, $teams) {
// ...
if ($teams) {
$table->id(); // <-------- USED FOR PRIMARY KEY
$table->uuid($columnNames['team_foreign_key'])->nullable();
$table->index($columnNames['team_foreign_key'], 'model_has_roles_team_foreign_key_index');
$table->index(
[$columnNames['team_foreign_key'], $pivotRole, $columnNames['model_morph_key'], 'model_type'],
'model_has_roles_role_model_type_primary'
);
} else {
$table->primary(
[$pivotRole, $columnNames['model_morph_key'], 'model_type'],
'model_has_roles_role_model_type_primary'
);
}
}); What do you think about this approach? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I’m working on a project where I need to assign global roles to users who can belong to different Jetstream teams, regardless of the team they are part of. I could implement this by linking the roles to a user across all the teams they belong to, but I’m looking for a cleaner solution.
Has anyone implemented something similar or has any recommendations on how to structure this more efficiently? Any ideas or advice would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions