Merge branch 'master' of https://github.com/sebathefox/skolehjem-webapp
This commit is contained in:
commit
5f08267ec5
skolehjem/app/Http/Controllers
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\WashingReservation;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Http\Request;
|
||||
|
@ -140,6 +141,10 @@ class WashingMachineController extends Controller
|
|||
public function destroy($id)
|
||||
{
|
||||
$machine = WashingMachine::find($id);
|
||||
|
||||
$allReservations = WashingReservation::query()->where('machine_id', '=', $id);
|
||||
|
||||
$allReservations->delete();
|
||||
$machine->delete();
|
||||
|
||||
return redirect()->route("washing-machines.index");
|
||||
|
|
Loading…
Reference in New Issue