<?php

namespace Modules\Admin\app\Http\Controllers;

use App\Http\Controllers\Controller;

class AbstractController extends Controller
{
    public static function ResultData($models)
    {
        return $models->withPath('');
    }

    public static function ResultSuccess($data = [], $message = "Successfull")
    {
        return response()->json(
            [
                'message' => $message,
                'errors' => false,
                'result' => "Success",
                'status' => true,
                'data' => $data,
            ],
            200
        );
    }
    public static function ResultError($message, $data = [], $statusCode = 500)
    {
        return response()->json(
            [
                'message' => $message,
                'errors' => true,
                'status' => false,
                'result' => 'ERROR',
                'data' => $data,
            ],
            $statusCode
        );
    }
}
