user()->currentWorkspaceUser(); if ($workspaceUser->role->is(WorkspaceUserRole::Owner)) { return true; } if ($workspaceUser->role->is(WorkspaceUserRole::Manager)) { return (bool) ($workspaceUser->permissions[Permission::CanManageTeam] ?? false); } return false; } /** * Get the validation rules that apply to the request. * * @return array|string> */ public function rules(): array { return [ 'role' => ['required', 'in:manager,worker'], ]; } /** * Handle a failed authorization attempt. */ protected function failedAuthorization(): void { abort(404); } }