Agrega Productos y sus recetas

This commit is contained in:
2021-07-12 19:10:43 -04:00
parent df5238850e
commit d3713e2f93
10 changed files with 408 additions and 1 deletions

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

View File

@@ -11,7 +11,7 @@ class ModelNotFoundException extends Exception {
public function __construct($modelName, $id) {
$this->modelName= $modelName;
$this->id = $id;
$this->id = is_array($id) ? implode(', ', $id) : $id;
}
public function render($request) {