public function __construct() { //$route_url = '/' . Route::getCurrentRoute()->getPath(); /*if(!Session::has($route_url)){ $permission = Permission::with('parent')->select('id','route', 'name','display_name','parent_id') ->where('route', $route_url) ->first(); Session::push($route_url, $permission); }*/ if (!Session::has('permissions')) { $roles = Auth::admin()->get()->roles()->first(); $permission_ids = PermissionRole::where('role_id', $roles->pivot->role_id)->lists('permission_id'); $permissions = Permission::where('type', 1)->whereIn('id', $permission_ids)->get(); Session::put('permissions', $permissions); } $this->systemConfig = Cache::rememberForever('system_config', function () { return System::get(); }); }
/** * 初始化参数 * @return mixed */ public function initialize() { $bucket = config('quickcms.qiniu_bucket'); $accessKey = config('quickcms.qiniu_access_key'); $secretKey = config('quickcms.qiniu_secret_key'); $policy = ['scope' => $bucket, 'deadline' => time() + 604800]; $mac = new \Qiniu\Mac($accessKey, $secretKey); $upToken = $mac->signWithData(json_encode($policy)); $version_code = Request::header('build'); $appstore_reviewing = false; $review_system = Cache::rememberForever('review_system', function () { return System::where('system_key', 'app_review')->first(); }); $build_system = Cache::rememberForever('build_system', function () { return System::where('system_key', 'build')->first(); }); if (count($review_system) > 0 && $review_system->system_value == 1) { if (count($build_system) > 0 && $build_system->system_value == $version_code) { $appstore_reviewing = true; } } $configs = array('up_token' => $upToken, 'appstore_reviewing' => $appstore_reviewing, 'custom_data' => config('quickcms.custom_data', [])); return ApiResponse::responseSuccess($configs); }