<?php
namespace App\Services\Response;

use Illuminate\Http\Exceptions\HttpResponseException;

/**
 * Class based Helper to upload and resize Images
 */
class ResponseService
{

    public static function response($response)
    {
        if($response['status'] == 200)
        {
            return response()->json
            (
                [
                    'message' => $response['message'],
                    'data' => $response['data']
                ]
                , $response['status']
            );
        }
        throw new HttpResponseException(response()->json(['errors' => $response['message']], $response['status']));
    }

    public static function notFound()
    {
        $status = 400;
        $message = __('web.not_found');
        throw new HttpResponseException(response()->json(['errors' => $message], $status));
    }

    public static function responseFail($error)
    {
        $status = 400;
        $message = $error;
        throw new HttpResponseException(response()->json(['errors' => $message], $status));
    }
}


