'required|max:5', 'name' => 'required|max:255', ]; } /** * Determine if the user is authorized to make this request. */ public function authorize() : bool { return true; } public function prepareForValidation() : void { if ($this->method() == 'POST') { $this->merge([ 'code' => IdGenerator::generate( ['table' => 'jenis_jaminan', 'length' => 5, 'prefix' => 'JJ', 'field' => 'code'], ), ]); } } }