AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Jet calendar applcatio4/30/2023 ![]() Team member removal may be customized by modifying the App\Actions\Jetstream\RemoveTeamMember action class. You are free to customize this action based on the needs of your particular application. This action is responsible for validating that the user can actually be added to the team and then adding the user to the team. The class' add method is invoked with the currently authenticated user, the Laravel\Jetstream\Team instance, the email address of the user being added to the team, and the role (if applicable) of the user being added to the team. Like the customization process for other Jetstream features, team member addition logic may be customized by modifying the App\Actions\Jetstream\AddTeamMember action class. Naturally, you are free to modify this policy as you see fit. This restriction is defined in the App\Policies\TeamPolicy class. By default, only team owners can manage team membership. ![]() Team members may be added and removed from a team via Jetstream's "Team Settings" view. $team - > userHasPermission ( $user, $permission ) : bool Determine if the given user is a team member with the given permission. $team - > hasUserWithEmail ( $emailAddress ) : bool ![]() Determine if the team has a member with the given email address. $team - > users : Illuminate\ Database \Eloquent \Collection // Determine if the given user is a team member. $team - > allUsers ( ) : Illuminate\ Database \Eloquent \Collection // Get all of the team's users, excluding the owner. $team - > owner : App\ Models \User // Get all of the team's users, including the owner. This relationship may be used to scope your other Eloquent queries by the user's current team: You may access the user's current team using the $user->currentTeam Eloquent relationship. For example, if you are building a calendar application, your application would display the upcoming calendar events for the user's current team. This is the team that the user is actively viewing resources for. $user - > hasTeamPermission ( $team, 'server:create' ) : boolĮvery user within a Jetstream application has a "current team". $user - > teamPermissions ( $team ) : array // Determine if a user has a given team permission. Access an array of all permissions a user has for a given team. $user - > hasTeamRole ( $team, 'admin' ) : bool ![]() $user - > teamRole ( $team ) : \ Laravel \Jetstream \Role // Determine if the user has the given role on the given team. Get the role that the user is assigned on the team. Determine if a user belongs to a given team. $user - > personalTeam ( ) : Laravel\ Jetstream \Team // Determine if a user owns a given team. $user - > teams : Illuminate\ Database \Eloquent \Collection // Access a user's "personal" team. $user - > ownedTeams : Illuminate\ Database \Eloquent \Collection // Access all of the teams that a user belongs to but does not own. $user - > allTeams ( ) : Illuminate\ Support \Collection // Access all of a user's owned teams. $user - > currentTeam : Laravel\ Jetstream \Team // Access all of the team's (including owned teams) that a user belongs to. Access a user's currently selected team. This trait provides a variety of helpful methods that allow you to inspect a user's teams: This trait is automatically applied to your application's App\Models\User model during Jetstream's installation. Information about a user's teams may be accessed via the methods provided by the Laravel\Jetstream\HasTeams trait. Additional input fields that are specified on the team creation forms will be provided to the App\Actions\Jetstream\CreateTeam action class when the user creates a team. When using the Inertia stack, this view is displayed using the resources/js/Pages/Teams/CreateTeamForm.vue template. When using the Livewire stack, the team creation view is displayed using the resources/views/teams/ Blade template. You are free to modify these actions as required based on your application's needs. Each of these actions is invoked when their corresponding task is performed by the user in the application's UI. These actions include CreateTeam, UpdateTeamName, and DeleteTeam. Like many other Jetstream features, team creation and deletion logic may be customized by modifying the relevant action classes within your app/Actions/Jetstream directory. The team creation view is accessed via the top-right user navigation dropdown menu. If it doesn't work for your use case, feel free to create a non-team based Jetstream application and manually add team functionality to your application based on your own needs. Jetstream's team scaffolding and opinions may not work for every application.
0 Comments
Read More
Leave a Reply. |