I got Laravel to work at last. There's probably a smarter way but in the validator method I use the array $data, and in the create method - the Request $request. Don't forget to namespace both the validator and the request into the controller
protected function validator(array $data)
{
return Validator::make($data, [
'content' => 'required'
]);
}
protected function create(Request $request)
{
return Comment::create([
'user_id' => Auth::user()->id,
'content' => nl2br($request->input('content'))
]);
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community