ERP-API/app/Http/Requests/Accounting/Account/ListRequest.php

40 lines
1.1 KiB
PHP

<?php
namespace App\Http\Requests\Accounting\Account;
use Illuminate\Foundation\Http\FormRequest;
class ListRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return auth()->user()->checkPermission("accounting.account:read");
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'limit' => 'nullable',
'offset' => 'nullable',
'search' => 'nullable',
'filter' => 'nullable|array',
'filter.*.column' => 'required|in:code,name,sheet,type,category,subcategory',
'filter.*.operator' => 'nullable|in:eq,in',
'filter.*.query' => 'required',
'sort' => 'nullable|array',
'sort.column' => 'nullable|in:code,name,sheet,type,category,subcategory',
'sort.dir' => 'nullable',
];
}
}