<?php

namespace App\Http\Controllers;

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

class Controller extends BaseController
{
    use AuthorizesRequests, ValidatesRequests;
    public function hasAnyAccess($permissions){
      // dump(Config::get('permissions.' ));
      $required_permission = array_sum($permissions);
      #$system_permissions = Models\Permission::where('status', 'active')->get();
      
      if (session('current_user.permissions') <> '') {
        if ((int)session('current_user.permissions') & $required_permission) {
          return true;
        }
        else{
          return false;
        }
      }      
      return false;
    }
}
