mardi 26 mars 2019

validate() function is not working in PostsController

After submit the data from create view(PostsController) request goes to store method(PostsController)but neither data is validating nor throwing an error.

after removing the validate(), it is working and output is: 123

class PostsController extends Controller
{
.
..
...
public function store(Request $request)
    {
       $this->validate($request, [
            'title' => 'required',
            'body' => 'required',
             ]);
       return 123;
    }

}


Output after the validate the data:

123



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2WviIkV
via IFTTT

Aucun commentaire:

Enregistrer un commentaire