X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FPolicies%2FEpisodePolicy.php;h=1957bbe1f1c704dc9ee12b36c71f469ec1fe6353;hb=999e4fe15dbc31d2d2874381cc8b7c24fbded410;hp=6be9ad02ec02855cf5da87a7945e19775fdd0a2b;hpb=638802eaf20d636c16d7ce337ace508708705f2c;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. *