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

36 lines
973 B
PHP

<?php
namespace App\Http\Requests\Accounting\Account;
use Illuminate\Foundation\Http\FormRequest;
class StoreRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return auth()->user()->checkPermission("accounting.account:create");
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'name' => 'required|string',
'code' => 'required|string|unique:accounts',
'sheet' => 'required|string',
'type' => 'required|string',
'category' => 'required|string',
'subcategory' => 'nullable|string',
'structure' => 'required|string',
'totaling' => 'nullable|string',
];
}
}