<?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);
    }
}
