Answer the question
In order to leave comments, you need to log in
Where to implement such logic?
Hello. Got into application development to non-standard business logic. Here is a piece inserted into the controller:
public function update(Request $request, $id)
{
$part = RollPartsStorage::find($id);
$part->lenght = $part->lenght - $request->lenght;
$part->save();
$roll_plus = new RollPartsStorage;
$roll_plus->roll_storage_id = $request->roll_storage_id;
$roll_plus->price = $request->price;
$roll_plus->provider_id = $request->provider;
$roll_plus->status_id = 1;
$roll_plus->type_id = 2;
$roll_plus->width = $part->width - $request->width;
$roll_plus->lenght = $request->lenght;
$roll_plus->save();
$action = new RollActionsStorage;
$action -> roll_storage_id = $request->roll_storage_id;
$action -> type_id = 2;
$action -> user_id = Auth::id();
$action -> reason = $request->reason;
$action -> width = $request->width;
$action -> lenght = $request->lenght;
$action->save();
return redirect(route('roll.show', ['id' => $request->roll_storage_id]))->with(['part_status' => 'Изменения сохранены!', 'part_color' => 'success']);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question