Posts

Showing posts from February 6, 2019

upload multi file to laravel

Image
0 hi i have laravel project and this is my html file <tr> <td>{{trans('language.files')}} </td> <td colspan='2'><input type='file' multiple name='files' class='form-control' required /></td> </tr> as you can see its file as array of files and this is the controller code if($request->files != null) { $i = 0; foreach($request->files as $key=> $file) { if(!empty($image)) { $user_id = $request->user_id; if(!file_exists(storage_path()."/app/public/$user_id")) File::makeDirectory(storage_path()."/app/public/$user_id"); // code to upload file $file[$i] in } $i++; } }

Vera Crux (civitas)

Image
Vera Crux (civitas) Res apud Vicidata repertae: civitas Civitas : Mexicum Locus : 19°26'5"N, 96°22'59"W Situs interretialis Fines Subdivisio superior : Mexicum Territoria finitima : Chiapae , Puebla , Hidalgum , Tamaulipae , Sanctus Ludovicus Potosius Forma Area : 71 820 chiliometrum quadratum Caput : Xalapa Gubernium Consilium : Congress of Veracruz Vita Zona horaria : UTC−6 Tabula aut despectus Vera Crux [1] [2] est Mexici civitas, in septentrione Tamaulipis, in austro Guaxacae et Chiapis, in austro-oriente Tabasco, in occidente Pueblae et Hidalgo et Sancto Ludovico Potosiensi, et denique in oriente Sinui Mexicano confinis. Ialapa [3] caput civitatis est, sed portus amplissimus et urbs prima est Vera Crux. Notae | ↑ "Nova Hispania" in Iohannes Iacobus Hofmannus, Lexicon universale (1698) ~ ↑ "Dioecesis Verae Crucis" e The Hierarchy of the Catholic Church (situs a Davide M. Cheney e

How do I generate a new Error() with Mongoose that maintains the same nested structure as the standard...

Image
1 0 Question How do I generate an error that is more easily iterable on the front-end from Mongoose, that maintains the standard Validation error structure using new Error() ? Issue I have a handful of validations that run on my Mongoose schema. I have a pre-save function that I'm using to encrypt a password using bcrypt . I'm trying to make sure I catch all promises, and I've got a situation where I may receive an error from bcrypt if a user's password is not successfully hashed. I'd like to generate a generic error that I can have display on the front-end. Right now I iterate through validation errors in the error.errors object which is returned from Mongoose in the following format: // Schema const MySchema = new Schema( { myField: { type: String, minlength: [3