73 lines
2.8 KiB
PHP
73 lines
2.8 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Requests\Collections;
|
|
|
|
use App\Models\Collection;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class CollectionOwnerSearchRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return $this->user() !== null;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'q' => ['nullable', 'string', 'max:120'],
|
|
'type' => ['nullable', 'string', 'in:' . implode(',', [
|
|
Collection::TYPE_PERSONAL,
|
|
Collection::TYPE_COMMUNITY,
|
|
Collection::TYPE_EDITORIAL,
|
|
])],
|
|
'visibility' => ['nullable', 'string', 'in:' . implode(',', [
|
|
Collection::VISIBILITY_PUBLIC,
|
|
Collection::VISIBILITY_UNLISTED,
|
|
Collection::VISIBILITY_PRIVATE,
|
|
])],
|
|
'lifecycle_state' => ['nullable', 'string', 'in:' . implode(',', [
|
|
Collection::LIFECYCLE_DRAFT,
|
|
Collection::LIFECYCLE_SCHEDULED,
|
|
Collection::LIFECYCLE_PUBLISHED,
|
|
Collection::LIFECYCLE_FEATURED,
|
|
Collection::LIFECYCLE_ARCHIVED,
|
|
Collection::LIFECYCLE_HIDDEN,
|
|
Collection::LIFECYCLE_RESTRICTED,
|
|
Collection::LIFECYCLE_UNDER_REVIEW,
|
|
Collection::LIFECYCLE_EXPIRED,
|
|
])],
|
|
'mode' => ['nullable', 'string', 'in:' . implode(',', [
|
|
Collection::MODE_MANUAL,
|
|
Collection::MODE_SMART,
|
|
])],
|
|
'campaign_key' => ['nullable', 'string', 'max:80'],
|
|
'program_key' => ['nullable', 'string', 'max:80'],
|
|
'workflow_state' => ['nullable', 'string', 'in:' . implode(',', [
|
|
Collection::WORKFLOW_DRAFT,
|
|
Collection::WORKFLOW_IN_REVIEW,
|
|
Collection::WORKFLOW_APPROVED,
|
|
Collection::WORKFLOW_PROGRAMMED,
|
|
Collection::WORKFLOW_ARCHIVED,
|
|
])],
|
|
'health_state' => ['nullable', 'string', 'in:' . implode(',', [
|
|
Collection::HEALTH_HEALTHY,
|
|
Collection::HEALTH_NEEDS_METADATA,
|
|
Collection::HEALTH_STALE,
|
|
Collection::HEALTH_LOW_CONTENT,
|
|
Collection::HEALTH_BROKEN_ITEMS,
|
|
Collection::HEALTH_WEAK_COVER,
|
|
Collection::HEALTH_LOW_ENGAGEMENT,
|
|
Collection::HEALTH_ATTRIBUTION_INCOMPLETE,
|
|
Collection::HEALTH_NEEDS_REVIEW,
|
|
Collection::HEALTH_DUPLICATE_RISK,
|
|
Collection::HEALTH_MERGE_CANDIDATE,
|
|
])],
|
|
'partner_key' => ['nullable', 'string', 'max:80'],
|
|
'experiment_key' => ['nullable', 'string', 'max:80'],
|
|
'placement_eligibility' => ['nullable', 'boolean'],
|
|
];
|
|
}
|
|
} |