isAdmin(); } /** * Determine whether the user can update the model. * * @param \App\Models\User $user * @param \App\Models\Channel $channel * @return \Illuminate\Auth\Access\Response|bool */ public function update(User $user, Channel $channel) { return $user->isAdmin(); } /** * Determine whether the user can delete the model. * * @param \App\Models\User $user * @param \App\Models\Channel $channel * @return \Illuminate\Auth\Access\Response|bool */ public function delete(User $user, Channel $channel) { return false; } /** * Determine whether the user can restore the model. * * @param \App\Models\User $user * @param \App\Models\Channel $channel * @return \Illuminate\Auth\Access\Response|bool */ public function restore(User $user, Channel $channel) { return false; } /** * Determine whether the user can permanently delete the model. * * @param \App\Models\User $user * @param \App\Models\Channel $channel * @return \Illuminate\Auth\Access\Response|bool */ public function forceDelete(User $user, Channel $channel) { return false; } /** * Determine whether the user can add episodes to the channel. * * @param \App\Models\User $user * @param \App\Models\Channel $channel * @return \Illuminate\Auth\Access\Response|bool */ public function addEpisode(User $user, Channel $channel) { return $user->channel_crews() ->where('role', '=', 'admin') ->where('channel_id', '=', $channel->id) ->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. * * @param \App\Models\User $user * @param \App\Models\Channel $channel * @return \Illuminate\Auth\Access\Response|bool */ public function removeEpisode(User $user, Channel $channel) { return $user->channel_crews() ->where('role', '=', 'admin') ->where('channel_id', '=', $channel->id) ->count() > 0; } }