ldc-gen-game-web/app/Http/Requests/Bo/BannedIps/StoreBannedIpRequest.php
2023-12-05 12:33:25 +01:00

44 lines
873 B
PHP

<?php
namespace App\Http\Requests\Bo\BannedIps;
use App\Models\BannedIp;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Gate;
class StoreBannedIpRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize()
{
return Gate::check('create', BannedIp::class);
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'ip' => 'required|ip|unique:banned_ips,ip',
];
}
/**
* Get custom attributes for validator errors.
*
* @return array
*/
public function attributes(): array
{
return [
'ip' => trans('validation.custom.ip'),
];
}
}