wamesk/core

dev-master 2024-06-03 10:25 UTC

This package is auto-updated.

Last update: 2024-09-03 11:01:21 UTC


README

安装

composer require wamesk/core

使用

异常处理器

当使用 wamesk/laravel-auth 包或 WameException 异常时,您需要注册此 ExceptionHandler

// bootstrap/app.php

->withExceptions(function (Exceptions $exceptions) {
    ...
    $exceptions->render(resolve(ExceptionHandler::class));
    ...
})->create();

WameException

创建用于与 ExceptionHandler 一起使用以自定义前端响应,可以在项目中任何位置使用。

WameException 中的代码将用作状态码

消息将用作代码,并将其放在 __() 中作为消息

响应示例

{
    "code": "examplecode",
    "message": "examplemessagee"
}