I am saving all request fields from my model with a one liner in Laravel like this:
$imageRequest = Auth::user()->imageRequests()->save(new ImageRequest($request->all()));
My model ImageRequest has a bunch of fillables that are in the $request but there is 1 field that is not in the request that I need to save also in the table.
Can I do this in my one liner or do I need to do every fillable seperately like this:
$imageRequest = new ImageRequest;
$imageRequest->fillable1 = $request->fillable1
...
$imageRequest->fillableNotInForm = "hello";
$imageRequest->save();
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire