Hmm... I copied/pasted it, and it worked out fine. I can't see anything that would be an issue either.
Are you sure it's hitting that controller method, and also, can you post your ItemRequest class?
thomastkim said:
Hmm... I copied/pasted it, and it worked out fine. I can't see anything that would be an issue either.
Are you sure it's hitting that controller method, and also, can you post your ItemRequest class?
Hmm strange :/ This is the ItemRequest class:
<?php
namespace App\Http\Requests;
use App\Http\Requests\Request;
use Auth;
class ItemRequest extends Request
{
/**
* 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
*/
public function rules()
{
$rules = [
'title' => 'required|min:5',
'description' => 'required|min:10',
'price' => 'required',
'category_id' => 'required',
];
if($this->request->get('dimension_measurement')){
foreach($this->request->get('dimension_measurement') as $key => $val){
$rules['dimension_measurement.'.$key] = 'numeric';
}
}
return $rules;
}
}
Could it be because I am using the inbuilt php server?
I don't think so. It works out for me.
If you dd($request->all())
, what do you get?
Never mind, I had extended App\Http\Requests\Request instead of Illuminate\Http\Request in my ItemRequest class so it didn't work! Thanks for the help :)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community