Server IP : / Your IP : 10.244.4.16 [ Web Server : nginx/1.25.3 System : Linux escuela-portal-app-54f56585bc-kst6g 5.15.0-1084-azure #93-Ubuntu SMP Sat Mar 15 14:12:29 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.2.13 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : OFF | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /proc/448/cwd/app/vendor/laravel/jetstream/src/ |
Upload File : |
<?php namespace Laravel\Jetstream; use Illuminate\Database\Eloquent\Model; abstract class Team extends Model { /** * Get the owner of the team. * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function owner() { return $this->belongsTo(Jetstream::userModel(), 'user_id'); } /** * Get all of the team's users including its owner. * * @return \Illuminate\Support\Collection */ public function allUsers() { return $this->users->merge([$this->owner]); } /** * Get all of the users that belong to the team. * * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany */ public function users() { return $this->belongsToMany(Jetstream::userModel(), Jetstream::membershipModel()) ->withPivot('role') ->withTimestamps() ->as('membership'); } /** * Determine if the given user belongs to the team. * * @param \App\Models\User $user * @return bool */ public function hasUser($user) { return $this->users->contains($user) || $user->ownsTeam($this); } /** * Determine if the given email address belongs to a user on the team. * * @param string $email * @return bool */ public function hasUserWithEmail(string $email) { return $this->allUsers()->contains(function ($user) use ($email) { return $user->email === $email; }); } /** * Determine if the given user has the given permission on the team. * * @param \App\Models\User $user * @param string $permission * @return bool */ public function userHasPermission($user, $permission) { return $user->hasTeamPermission($this, $permission); } /** * Get all of the pending user invitations for the team. * * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function teamInvitations() { return $this->hasMany(Jetstream::teamInvitationModel()); } /** * Remove the given user from the team. * * @param \App\Models\User $user * @return void */ public function removeUser($user) { if ($user->current_team_id === $this->id) { $user->forceFill([ 'current_team_id' => null, ])->save(); } $this->users()->detach($user); } /** * Purge all of the team's resources. * * @return void */ public function purge() { $this->owner()->where('current_team_id', $this->id) ->update(['current_team_id' => null]); $this->users()->where('current_team_id', $this->id) ->update(['current_team_id' => null]); $this->users()->detach(); $this->delete(); } }