lundi 7 novembre 2016

Laravel file upload name must be unique

As the title says I need for when user uploads a file for name to be unique, and if not throw a error.

This is my code

    $this->validate($request, [
      'file' => 'unique:files,name',
       ]);

But it still passes and insert data into database. Does anyone have idea?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire