<?php

namespace App\Http\Controllers\API;

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

use App\Libraries\Response;
use App\Libraries\Users\AuthAPI;
use App\Http\Traits\CustomerId;

/**
 * Class ApiController
 *
 * @package App\Http\Controllers\API
 */
class ApiController extends BaseController
{

    use AuthorizesRequests;
    use DispatchesJobs;
    use ValidatesRequests;
    use CustomerId;

    /**
     * @var \App\Libraries\Response
     */
    public $response;

    /**
     * @var \App\Models\User
     */
    public $user;

    public function __construct()
    {
        \DB::enableQueryLog();

        $this->response = new Response();

        $token = request()->header('Token');
        $this->user = ($token) ? AuthAPI::getInstance()->getSession($token) : false;
    }
}