feat: Implement client-facing service management API with UUID for services and bulk actions for product services.

This commit is contained in:
pbao9
2026-03-13 15:17:23 +07:00
parent 5160ac967a
commit e0341363f6
16 changed files with 479 additions and 3 deletions
+14
View File
@@ -3,6 +3,8 @@
namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Database\QueryException;
use Illuminate\Database\UniqueConstraintViolationException;
use Throwable;
class Handler extends ExceptionHandler
@@ -34,6 +36,18 @@ class Handler extends ExceptionHandler
*/
public function register()
{
// Duplicate constraint
$this->renderable(function (QueryException $e, $request) {
if ($e->errorInfo[1] == 1062) {
return response()->json([
'error' => true,
'message' => 'Dữ liệu đã tồn tại'
], 422);
}
});
$this->renderable(function (\Symfony\Component\HttpKernel\Exception\NotFoundHttpException $e, $request) {
if (!$request->expectsJson() && !$request->is('v1/*') && !$request->is('api/*')) {
return null;