Support the ongoing development of →
Database Forms Validation
Last updated 2 years ago.

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!


Your banner here too?

muppbarn muppbarn Joined 29 Mar 2016


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.