category_id) { $this->category_type = Category::find($this->category_id)->category_type; $this->merge([ 'category_type' => $this->category_type, ]); } } /** * Get the validation rules that apply to the request. * * @return array|string> */ public function rules(): array { return array_merge( ['category_type' => 'in:asset'], parent::rules(), ); } public function messages(): array { $messages = ['category_type.in' => trans('admin/models/message.invalid_category_type')]; return $messages; } }