Agrega Productos y sus recetas
This commit is contained in:
21
backend/app/Exceptions/AlreadyExistsException.php
Normal file
21
backend/app/Exceptions/AlreadyExistsException.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
class AlreadyExistsException extends Exception {
|
||||
|
||||
protected $model;
|
||||
|
||||
public function __construct($model) {
|
||||
$this->model = $model;
|
||||
}
|
||||
|
||||
public function render($request) {
|
||||
return response()->json([
|
||||
'error' => 'already_exists',
|
||||
'message' => 'Ya existe la ' . $this->model
|
||||
], 400);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user