<?php
namespace AppHttpRequests;
use IlluminateFoundationHttpFormRequest;
use IlluminateSupportFacadesAuth;
class ItemRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return Auth::check();
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, mixed>
*/
// validasi data
public function rules()
{
return [
'nama' => 'required|string|max:255',
'type_id' => 'required|integer|exists.types,'.$this->id,
'brand_id' => 'required|integer|exists.brands,'.$this->id,
'photos' => 'nullable|array',
'photos.*' => 'nulable|image|mimes:jpeg,png,jpg|max:2048',
'features' => 'nullable|string',
'price' => 'required|numeric',
'star' => 'nullable|numeric',
'review' => 'nullable|numeric'
];
}
}
I have a problem in my Request. In validation data exists.types
does not exist.
How to solve this error?
Thank you.