check() and $this->json(); } /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { return [ 'id' => 'required|numeric', 'model' => [ \sprintf('in:%s,%s', Breeder::class, Recipe::class), // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed,Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassAfterLastUsed function ($attribute, $value, $fail) { $table = (new $value())->getTable(); Validator::validate( ['model' => $this->id], ['model' => "required|exists:{$table},id"] ); } ] ]; } }