This commit is contained in:
frederikpyt 2020-08-05 10:12:12 +02:00
commit 5f08267ec5
1 changed files with 5 additions and 0 deletions

View File

@ -2,6 +2,7 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\WashingReservation;
use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\View\Factory; use Illuminate\Contracts\View\Factory;
use Illuminate\Http\Request; use Illuminate\Http\Request;
@ -140,6 +141,10 @@ class WashingMachineController extends Controller
public function destroy($id) public function destroy($id)
{ {
$machine = WashingMachine::find($id); $machine = WashingMachine::find($id);
$allReservations = WashingReservation::query()->where('machine_id', '=', $id);
$allReservations->delete();
$machine->delete(); $machine->delete();
return redirect()->route("washing-machines.index"); return redirect()->route("washing-machines.index");