<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Support\Facades\Http;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

    public function callJava($request, $endPoint, $data)
    {
        $url =  config('stag.backendUrl') . $endPoint;
        
        $response = Http::asForm()
            ->withHeaders([
                'secret' => 'superman'
            ])
            ->post($url, $data)
            ->json();
        return $response;
    }
    public function pass($data = null) : array
    {
        return [
            'success'=>true,
            'data'=>$data,
        ];
    }
    
	public function fail($message) : array
    {
        return [
            'success'=>false,
            'message'=>$message
        ];
    }
}
