Esempio n. 1
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, Batch $batch)
 {
     //Handle validation
     $this->validate($request, ['description' => 'required', 'parcel_list' => 'required', 'destination' => 'required'], ['parcel_id.required' => 'Please select the parcels you want to add to batch.']);
     // Uncomment and modify if you need to validate any input.
     $data = $request->all();
     $data['status_id'] = 1;
     $batch->update($data);
     $batch->parcels()->sync($request->get('parcel_list'));
     event(new ActivityLog(auth()->user()->username . ' has updated the batch ' . $batch->description . ' with the code ' . $batch->code . ' successfully.'));
     alert()->success('Batch updated successfully.', 'success');
     return redirect('batch');
 }