Files
unified-restaurant-original/backend/app/Exceptions/CantDeleteHasChildException.php

24 lines
490 B
PHP

<?php
namespace App\Exceptions;
use Exception;
class CantDeleteHasChildException extends Exception {
protected $parent;
protected $child;
public function __construct($parent, $child) {
$this->parent = $parent;
$this->child = $child;
}
public function render($request) {
return response()->json([
'error' => 'cant_delete',
'message' => $this->parent . ' tiene ' . $this->child . ' asociados'
], 400);
}
}