ldc-gen-game-web/app/Http/Requests/Bo/BannedIps/UpdateBannedIpRequest.php
noah.lancien 218a3a7891 phpstan
2024-01-31 09:03:18 +00:00

37 lines
839 B
PHP

<?php
namespace App\Http\Requests\Bo\BannedIps;
use Illuminate\Support\Facades\Gate;
use Illuminate\Validation\Rule;
class UpdateBannedIpRequest extends StoreBannedIpRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize()
{
return Gate::check('update', $this->route('banned_ip'));
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
/** @var \App\Models\BannedIp */
$ipToBanModel = $this->route('banned_ip');
return [
'ip' => [
'required', 'ip',
Rule::unique('banned_ips', 'ip')
->ignore($ipToBanModel->ip, 'ip')
],
];
}
}