diff --git a/app/Http/Controllers/JoinedController.php b/app/Http/Controllers/JoinedController.php index fdaf961..b9daa19 100644 --- a/app/Http/Controllers/JoinedController.php +++ b/app/Http/Controllers/JoinedController.php @@ -44,5 +44,7 @@ public function update(UpdateJoinedRequest $request, Joined $joined) public function destroy(Joined $joined) { + $joined->remove(); + return redirect()->route('admin.joined.index')->with('success', 'Fanlisting removed.'); } } diff --git a/app/Models/Joined.php b/app/Models/Joined.php index a6ecd5a..b031d8b 100644 --- a/app/Models/Joined.php +++ b/app/Models/Joined.php @@ -84,4 +84,12 @@ public function patch(array $validated) : Joined return $this; } + + /* ------------------------------------------------------------------------------ remove ---- */ + + public function remove() : void + { + $this->categories()->detach(); + $this->delete(); + } }