Validaciones y Zonas de produccion

This commit is contained in:
2021-07-12 11:05:50 -04:00
parent 4f1dfd1221
commit d64dacee8d
9 changed files with 186 additions and 2 deletions

View File

@@ -0,0 +1,23 @@
<?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);
}
}

View File

@@ -18,8 +18,8 @@ class GenericException extends Exception {
public function render($request) {
return response()->json([
'error' => $this->error
'error' => $this->error,
'message' => $this->message
], $status);
], $this->status);
}
}