<?php

namespace App\Http\Traits;

trait ResponseTrait
{
    public static  function response($status = "success", $message = "", $data = [], $code = 200)
    {
        $body = [];
        $body['status'] = $status;
        if ($message)
            $body['message'] = $message;
        if ($data||$data == 0)
            $body['data'] = $data;
        return response()->json($body, $code);
    }
}
