2025-12-01 14:42:50 +01:00
|
|
|
<?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);
|
|
|
|
|
}
|
2025-12-01 14:42:50 +01:00
|
|
|
}
|