47 lines
1 KiB
PHP
47 lines
1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Back\InvoiceCompanies;
|
|
|
|
use App\Models\InvoiceCompany;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Support\Facades\Gate;
|
|
|
|
/**
|
|
* Handles authorization and validation for creating a new InvoiceCompany.
|
|
*/
|
|
class StoreInvoiceCompanyRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*
|
|
* @return boolean
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return Gate::check('create', InvoiceCompany::class);
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'name' => 'required|string|between:3,255',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get custom attributes for validator errors.
|
|
*
|
|
* @return array<string, string>
|
|
*/
|
|
public function attributes(): array
|
|
{
|
|
return [
|
|
'name' => trans('validation.custom.name'),
|
|
];
|
|
}
|
|
}
|