refactor(backend): reorganize domains into Core, Commerce, Ticketing and Shared
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Ticket\Requests;
|
||||
|
||||
use App\Domains\Ticket\Models\Ticket;
|
||||
use App\Domains\Ticket\Services\AdminAppTicketColumnService;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class AdminAppTicketIndexRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @return array<string, list<string>> */
|
||||
public function rules(): array
|
||||
{
|
||||
$tenant = $this->user()?->tenant()->first();
|
||||
$sortableKeys = $tenant === null
|
||||
? []
|
||||
: app(AdminAppTicketColumnService::class)->sortableKeys($tenant);
|
||||
|
||||
return [
|
||||
'q' => ['sometimes', 'nullable', 'string', 'max:255'],
|
||||
'category' => ['sometimes', 'nullable', 'string', 'max:255'],
|
||||
'product' => ['sometimes', 'nullable', 'string', 'max:255'],
|
||||
'type' => ['sometimes', 'nullable', 'string', 'max:255'],
|
||||
'date' => ['sometimes', 'nullable', 'date_format:Y-m-d'],
|
||||
'size' => ['sometimes', 'nullable', 'string', 'max:255'],
|
||||
'status' => [
|
||||
'sometimes',
|
||||
'nullable',
|
||||
Rule::in(Ticket::statuses()),
|
||||
],
|
||||
'page' => ['sometimes', 'integer', 'min:1'],
|
||||
'per_page' => ['sometimes', 'integer', 'min:1', 'max:100'],
|
||||
'sort_by' => ['sometimes', 'nullable', 'string', Rule::in($sortableKeys)],
|
||||
'sort_direction' => ['sometimes', 'nullable', 'string', Rule::in(['asc', 'desc'])],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user