mercredi 16 décembre 2020

How to upload image as multiple rows in laravel - If the image value is null then that row doesn't get inserted in the DB

Controller

foreach ($request->file('certificate') as $key => $certificate) {
    $education = new Education();
    $extension = $certificate->getClientOriginalName();
    $filename = time() . '.' . $extension;
    $certificate->move('uploads/certificate/', $filename);
    $education->certificate = $filename;
    $education->degree = request('degree')[$key];
    $education->subject = request('subject')[$key];
    $education->school = request('school')[$key];
    $education->univ = request('univ')[$key];
    $education->ddyear = request('year')[$key];
    $education->percentage = request('percentage')[$key];
    $education->save();
}


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

Aucun commentaire:

Enregistrer un commentaire