ldc-supportweb/app/Http/Requests/Back/InvoiceCompanies/StoreInvoiceCompanyRequest.php
2026-06-05 17:05:46 +02:00

48 lines
1 KiB
PHP

<?php
declare(strict_types=1);
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.
*/
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>
*/
#[\Override]
public function attributes(): array
{
return [
'name' => trans('validation.custom.name'),
];
}
}