v0.10.3a - Fixed: When deleting a location you now also delete the washing machines
This commit is contained in:
parent
e6e0e3c95d
commit
556f242595
|
@ -3,6 +3,7 @@
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Location;
|
use App\Location;
|
||||||
|
use App\WashingMachine;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
|
|
||||||
|
@ -130,6 +131,10 @@ class LocationController extends Controller
|
||||||
public function destroy($id)
|
public function destroy($id)
|
||||||
{
|
{
|
||||||
$locations = Location::find($id);
|
$locations = Location::find($id);
|
||||||
|
|
||||||
|
$washingMachines = WashingMachine::query()->where('location_id', '=', $id);
|
||||||
|
$washingMachines->delete();
|
||||||
|
|
||||||
$locations->delete();
|
$locations->delete();
|
||||||
|
|
||||||
return redirect()->route("locations.index");
|
return redirect()->route("locations.index");
|
||||||
|
|
Loading…
Reference in New Issue