<?php
namespace App\Traits;

Trait HttpResponses
{

    protected function success($data,$message=null,$code=200)
    {
        return response()->json([
            'data'=>$data,
            'message'=>$message,
            'status'=>'the request was successful'
        ],200);
    }

    protected function error($message=null,$code=500)
    {
        return response()->json([
            'message'=>$message,
            'status'=>'error has occurred'
        ],$code);

    }
}
