This repository has been archived on 2020-11-09. You can view files and clone it, but cannot push or open issues or pull requests.
Files
pingan/app/Merchant/Controllers/Traits/AjaxResponse.php
2020-08-06 16:37:53 +08:00

27 lines
619 B
PHP

<?php
namespace App\Merchant\Controllers\Traits;
trait AjaxResponse
{
protected function success($message = '', $url = null, $data = null)
{
return [
'code' => 1,
'msg' => $message ?: '操作成功',
'url' => is_null($url) ? '' : route($url),
'data' => $data,
];
}
protected function error($message = '', $url = null, $data = null)
{
return [
'code' => 0,
'msg' => $message ?: '操作失败',
'url' => is_null($url) ? '' : route($url),
'data' => $data,
];
}
}