ajax(); } /** * Get the validation rules that apply to the request. * * @return array|string> */ public function rules(): array { $supportedLocales = implode(',', LaravelLocalization::getSupportedLanguagesKeys()); return [ 'search' => 'required|string|between:3,255', 'page' => 'required|integer|min:1', 'locale' => "required|string|in:$supportedLocales", 'class' => [ 'required', 'string', 'starts_with:App\\Models\\', // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed function ($attribute, $value, $fail) { if (!class_exists($value)) { $fail("The specified model does not exist."); return; } if (!is_subclass_of($value, Model::class)) { $fail("The specified model is not an Eloquent model."); } }, ], ]; } }