ldc-groupe/app/Http/Requests/Back/Companies/UpdateCompanyRequest.php

37 lines
807 B
PHP
Raw Permalink Normal View History

<?php
namespace App\Http\Requests\Back\Companies;
use Illuminate\Support\Facades\Gate;
class UpdateCompanyRequest extends StoreCompanyRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize(): bool
{
return Gate::check('update', $this->route('company'));
}
2026-02-12 16:14:11 +01:00
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules(): array
{
$rules = [
'name' => [
'required',
'string',
'between:3,255',
'unique:companies,name,' . request()->company->getKey(),
],
];
return \array_merge(parent::rules(), $rules);
}
}