X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FPolicies%2FChannelPolicy.php;fp=app%2FPolicies%2FChannelPolicy.php;h=3e42c9f2790cc613809f9d158412951106f0e73a;hb=5a575dc29f3af10f1d8e142ff9e1c6ccdfa3b075;hp=03abdff04f6564278e5d1fe2efccf313bc61e8a4;hpb=b3beaab812bf23fec423d1d0823b2a25b137ccae;p=alttp.git diff --git a/app/Policies/ChannelPolicy.php b/app/Policies/ChannelPolicy.php index 03abdff..3e42c9f 100644 --- a/app/Policies/ChannelPolicy.php +++ b/app/Policies/ChannelPolicy.php @@ -106,6 +106,20 @@ class ChannelPolicy ->count() > 0; } + /** + * Determine whether the user can edit restreams on the channel. + * + * @param \App\Models\User $user + * @param \App\Models\Channel $channel + * @return \Illuminate\Auth\Access\Response|bool + */ + public function editRestream(User $user, Channel $channel) { + return $user->channel_crews() + ->where('role', '=', 'admin') + ->where('channel_id', '=', $channel->id) + ->count() > 0; + } + /** * Determine whether the user can remove episodes from the channel. *