Fixed url deletion

This commit is contained in:
Noah Lancien 2023-03-20 13:27:41 +00:00
parent 1c34b2aba0
commit d097ef0ef5

View file

@ -91,6 +91,12 @@ class UrlController extends Controller
*/
public function destroy(Url $url)
{
foreach ($url->history as $history) {
$history->deleteOrFail();
}
foreach ($url->stats as $stats) {
$stats->deleteOrFail();
}
$url->deleteOrFail();
return redirect()->route('bo.urls.index')
->with(['warning' => 'L\'url pour la clé ' . $url->key . ' a bien été supprimée.']);