Reputation: 6970
I'm just learning laravel4 through youtube videos and learning CRUD The RESTful Way I believe I did everything as the youtube does but somehow I do get this error and I have no idea where to start looking what I did wrong.
Can someone please give me an idea what error I should be looking for?
Thanks in advance ^_^
Upvotes: 0
Views: 55
Reputation: 25425
The problem is pretty clear: you're passing a string as the first parameter of a method which expects an array.
I'm guessing we're talking about Validation class here:
$validation = Validator::make($array, $rules);
where $array
is the array of field => value
pairs you want to validate, and $rules
is an array of rules you want to apply.
Just an example,
$validation = Validator::make(Input::all(),
array('username' => 'required', 'email' => 'required|email'));
Or, more verbose:
$fields = array('username' => Input::get('username'), 'email' => Input::get('username'));
$rules = array('username' => 'required', 'email' => 'required|email');
$validation = Validator::make($fields, $rules);
It's easily explained in the docs here.
Upvotes: 3