/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { DB::transaction(function () use($id) { $user = Auth::user(); $teachTime = TeachTime::findOrFail($id); $teachTime->updated_by = $user->name; $teachTime->deleted_by = $user->name; $teachTime->save(); // soft delete $teachTime->delete(); }); }