Esempio n. 1
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy(Batch $batch)
 {
     if ($batch->hasAlreadyBeenTracked()) {
         alert()->info('Batch could not be deleted because it has been processed', 'Oops');
         return redirect('batch');
     }
     $batch->track()->delete();
     event(new ActivityLog(auth()->user()->username . ' deleted the batch ' . $batch->description . ' with the code ' . $batch->code . ' successfully.'));
     $batch->delete();
     alert()->success('Batch deleted successfully', 'Success');
     return redirect('batch');
 }