> */ 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::STATUS_ACTIVE, Ticket::STATUS_USED, Ticket::STATUS_EXPIRED, ]), ], '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'])], ]; } }