Files
unified-restaurant-original/backend/app/Exceptions/AlreadyExistsException.php

22 lines
398 B
PHP

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