Skip to content

Disable company creation #66

Answered by andrewdwallo
xBigDaddyx asked this question in Q&A
Discussion options

You must be logged in to vote

I would suggest using any of these methods or, if you want to, you can use your own custom logic:

// Determine if the user has the given role on the given company...
$user->hasCompanyRole($company, 'admin') : bool

// Determine if a user has a given company permission...
$user->hasCompanyPermission($company, 'server:create') : bool

An example would look something like this, which would result in NOT allowing any user with the role "editor" to create a company:

/**
 * Determine whether the user can create models.
 */
 public function create(User $user, Company $company): bool
 {
     return !$user->hasCompanyRole($company, 'editor');
 }

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@andrewdwallo
Comment options

Answer selected by xBigDaddyx
@xBigDaddyx
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants