X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FPolicies%2FEpisodePolicy.php;fp=app%2FPolicies%2FEpisodePolicy.php;h=1957bbe1f1c704dc9ee12b36c71f469ec1fe6353;hb=5a575dc29f3af10f1d8e142ff9e1c6ccdfa3b075;hp=6be9ad02ec02855cf5da87a7945e19775fdd0a2b;hpb=b3beaab812bf23fec423d1d0823b2a25b137ccae;p=alttp.git diff --git a/app/Policies/EpisodePolicy.php b/app/Policies/EpisodePolicy.php index 6be9ad0..1957bbe 100644 --- a/app/Policies/EpisodePolicy.php +++ b/app/Policies/EpisodePolicy.php @@ -106,6 +106,20 @@ class EpisodePolicy ->count() > 0; } + /** + * Determine whether the user can edit restreams from the episode. + * + * @param \App\Models\User $user + * @param \App\Models\Episode $episode + * @return \Illuminate\Auth\Access\Response|bool + */ + public function editRestream(User $user, Episode $episode) { + return $user->channel_crews() + ->where('role', '=', 'admin') + ->whereIn('channel_id', $episode->channels->pluck('id')) + ->count() > 0; + } + /** * Determine whether the user can remove restreams from the episode. *