Validaciones y Zonas de produccion
This commit is contained in:
@@ -7,6 +7,7 @@ use App\Models\Sector;
|
||||
use App\Services\PaginatorService;
|
||||
use App\Services\UuidService;
|
||||
use App\Exceptions\GenericException;
|
||||
use App\Exceptions\CantdeletehasChild;
|
||||
use App\Exceptions\ModelNotFoundException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -118,6 +119,10 @@ class SectoresController extends Controller {
|
||||
throw new ModelNotFoundException("sector", $id);
|
||||
}
|
||||
|
||||
if($sector->canalesVenta()->count() > 0) {
|
||||
throw new CantDeleteHasChildException("sector", "canal_venta");
|
||||
}
|
||||
|
||||
$sector->delete();
|
||||
|
||||
return response()->json([], 204);
|
||||
|
||||
Reference in New Issue
Block a user