]> git.localhorst.tv Git - alttp.git/blobdiff - app/Policies/EpisodePolicy.php
crew management
[alttp.git] / app / Policies / EpisodePolicy.php
index 6be9ad02ec02855cf5da87a7945e19775fdd0a2b..1957bbe1f1c704dc9ee12b36c71f469ec1fe6353 100644 (file)
@@ -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.
         *