<?php namespace App\Http\Requests\Admin; use Gate; use Illuminate\Foundation\Http\FormRequest; class UpdateAttributeOptionRequest extends FormRequest { public function authorize() { return Gate::allows('attribute_option_edit'); } public function rules() { return [ 'attribute_id' => [ 'required', 'integer', 'exists:attributes,id', ], 'name' => [ 'string', 'max:50', 'required', 'unique:attribute_options,name,' . request()->route('attribute_option')->id, ], ]; } }