jbowman99's avatar

open an update form with 'files' => true option

Good afternoon,

I have an update form for with form model binding looks like this:

{!! Form::model($obit, ['method' => 'PATCH', 'route' => ['paidObits.update', $obit->id]]) !!}

i need to allow file uploads to this form also, not sure how to incorporate the 'files' => true to this form. Not quite sure where to put that so uploads are allowed.

Thanks

0 likes
8 replies
helmerdavila's avatar
Level 13
{!! Form::model($obit, ['method' => 'PATCH', 'route' => ['paidObits.update', $obit->id], 'files' => true]) !!}

API Docs (reference)

string model(mixed $model, array $options = array())
thomaskim's avatar

What helmerdavila put should be correct. Can you show us your controller or how you are trying to access the file?

jbowman99's avatar
{!! Form::label('submitPhoto', 'Submit a Photo:') !!} {!! Form::file('photo') !!}
jbowman99's avatar

public function updatePaidObit(Request $request, $id) { $obit = Obit::findOrFail($id); $obit ->update($request->all()); return redirect('obituaryHome'); }

jbowman99's avatar

I got it fixed

my update method never hit my store method where i was actually handling the photo save process...

thanks for the help guys....just not paying attention enough

Please or to participate in this conversation.