Contenu Laravel Access JSONResponse

    // In Controller 
    // Method 1: Consumes get_json()
	public function test_json()
    {
        $res = $this->get_json();

        // dd($res->getData());
        // {
        //     "error": "Error Message"
        //     "success": false
        // }

        $data = $res->getData();

        dd($data->error); // 'Error Message'
    }
	// Methos 2; returns json
    public function get_json()
    {
        return response()->json(['error' => 'Error Message','success' => false], 403);
    }
Smiling Starling