<?php
namespace App\Http\Controllers\v2019;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\JsonResponse;

use App\Traits\ReferenceData;

class MagazineController extends Controller
{ 
	use ReferenceData;
    public function __construct(Request $request) {
        if($request->has('debug') && $request->input('debug') == true) {
            $this->debug = true;			
        }
    }

	public function getMagazine(Request $request)
    {      
		$result = array();
		include_once "/home/steelmin/public_html/api/storage/v2019/magazine_pre.php";
		if ($request->has('accessToken') && $request->input('accessToken')!='') {
           // $auth = new authentication();
           $token = $request->input('accessToken');
           if(empty($token)){
			   $code = 2013;
				$message = "User not found.";
			}else{
				include_once "/home/steelmin/public_html/api/storage/v2019/magazine_post.php";
				$code = 1001;
				$message = "Success";
			}
        }else{
			
			$code = 1001;
			$message = "Success";
		}
		
	   return new JsonResponse(array("status"=>array("code" => $code, "message" => $message), "data"=> $result));
    } 
}
