like(); return $playlist; } if ($video instanceof Video) { $video->like(); return $video; } throw new Exception('None models detected to like.'); } /** * Remove the specified resource. * * @param null $_ * @param array $args * @return Model * * @throws Exception */ public function destroy($_, array $args): Model { $playlist = Arr::get($args, self::ATTRIBUTE_PLAYLIST); $video = Arr::get($args, self::ATTRIBUTE_VIDEO); if ($playlist instanceof Playlist) { $playlist->unlike(); return $playlist; } if ($video instanceof Video) { $video->unlike(); return $video; } throw new Exception('None models detected to unlike.'); } }