$songs */ class DeleteSongsRequest extends Request { /** @return array */ public function rules(): array { return [ 'songs' => 'required|array|exists:songs,id', ]; } public function authorize(): bool { if (License::isCommunity()) { return $this->user()->is_admin; } return Song::query() ->whereIn('id', $this->songs) ->get() ->every(fn (Song $song): bool => $song->owner_id === $this->user()->id); } }