改进 更新响应

This commit is contained in:
iVampireSP.com 2023-03-02 12:30:25 +08:00
parent 383736c41a
commit b24f26866b
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132

View File

@ -2,6 +2,7 @@
namespace App\Helpers;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\JsonResponse;
trait ApiResponse
@ -107,8 +108,12 @@ public function accepted($message = 'Accepted'): JsonResponse
return $this->success($message, 202);
}
public function updated($message = 'Updated'): JsonResponse
public function updated(mixed $message = 'Updated'): JsonResponse
{
if ($message instanceof Model) {
$message = $message->getChanges();
}
return $this->success($message);
}