<?php
/**
 * Created by PhpStorm.
 * User: Ming
 * Date: 2017/11/3
 * Time: 13:09
 */

namespace common\traits;

trait ResponseTrait
{
    public function success($data = null, $msg = null)
    {
        return ['code' => 200, 'data' => $data ?? [], 'msg' => $msg ?? 'success'];

    }

    public function fail($msg = null, $code = null)
    {
        return ['code' => $code ?? 500, 'data' => [], 'msg' => $msg ?? 'fail'];

    }
}