mercredi 14 avril 2021

Laravel 5.8 Image multiupload validation

Hello guys I have something like this in my UploadController:

$this->validate($request, [
            'covers' => 'required|mimes:jpg,jpeg,png,bmp|max:20000'
        ],[
            'covers.required' => 'Please upload an image',
            'covers.mimes' => 'Only jpeg,png and bmp images are allowed',
            'covers.max' => 'Sorry! Maximum allowed size for an image is 20MB',
        ]);

How can I display alerts in blade now? I tried to do it like this:

@if(session()->has('message'))
<div class="alert alert-info alert-dismissible fade show" role="alert">

  <button type="button" class="close" data-dismiss="alert" aria-label="Close">
    <span aria-hidden="true">&times;</span>
  </button>
</div>
@endif

My Function return:

return redirect()->back()->with(['message' => 'Changes saved!']);

but it display only message when it saved the changes successfully.



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

Aucun commentaire:

Enregistrer un commentaire