当前位置: 首页>>代码示例>>PHP>>正文


PHP config函数代码示例

本文整理汇总了PHP中config函数的典型用法代码示例。如果您正苦于以下问题:PHP config函数的具体用法?PHP config怎么用?PHP config使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了config函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: startup

 /**
  * Override startup of the Shell
  *
  * @return void
  */
 public function startup()
 {
     parent::startup();
     if (isset($this->params['connection'])) {
         $this->connection = $this->params['connection'];
     }
     $class = Configure::read('Acl.classname');
     list($plugin, $class) = pluginSplit($class, true);
     App::uses($class, $plugin . 'Controller/Component/Acl');
     if (!in_array($class, array('DbAcl', 'DB_ACL')) && !is_subclass_of($class, 'DbAcl')) {
         $out = "--------------------------------------------------\n";
         $out .= __d('cake_console', 'Error: Your current Cake configuration is set to an ACL implementation other than DB.') . "\n";
         $out .= __d('cake_console', 'Please change your core config to reflect your decision to use DbAcl before attempting to use this script') . "\n";
         $out .= "--------------------------------------------------\n";
         $out .= __d('cake_console', 'Current ACL Classname: %s', $class) . "\n";
         $out .= "--------------------------------------------------\n";
         $this->err($out);
         $this->_stop();
     }
     if ($this->command) {
         if (!config('database')) {
             $this->out(__d('cake_console', 'Your database configuration was not found. Take a moment to create one.'), true);
             $this->args = null;
             return $this->DbConfig->execute();
         }
         require_once APP . 'Config' . DS . 'database.php';
         if (!in_array($this->command, array('initdb'))) {
             $collection = new ComponentCollection();
             $this->Acl = new AclComponent($collection);
             $controller = new Controller();
             $this->Acl->startup($controller);
         }
     }
 }
开发者ID:rednazj,项目名称:Inventory,代码行数:39,代码来源:AclShell.php

示例2: boot

 /**
  *
  */
 public function boot()
 {
     $this->app->singleton('moip-client', function () {
         return new MoipClient(config('moip-assinaturas.api_token'), config('moip-assinaturas.api_key'), config('moip-assinaturas.environment', 'api'));
     });
     $this->app->singleton('moip-api', function () {
         return new Api(app('moip-client'));
     });
     $this->app->bind('moip-plans', function () {
         return app('moip-api')->plans();
     });
     $this->app->bind('moip-subscriptions', function () {
         return app('moip-api')->subscriptions();
     });
     $this->app->bind('moip-customers', function () {
         return app('moip-api')->customers();
     });
     $this->app->bind('moip-invoices', function () {
         return app('moip-api')->invoices();
     });
     $this->app->bind('moip-preferences', function () {
         return app('moip-api')->preferences();
     });
     $this->app->bind('moip-payments', function () {
         return app('moip-api')->payments();
     });
     $this->publishes([__DIR__ . '/../../../config/config.php' => config_path('moip-assinaturas.php')]);
 }
开发者ID:fripixel,项目名称:moip-assinaturas-laravel,代码行数:31,代码来源:SubscriptionServiceProvider.php

示例3: buildQiqiuImageUrl

 /**
  * Build the qiniu image url with the specified key
  * @param $key
  * @return null|string
  */
 public static function buildQiqiuImageUrl($key)
 {
     if (is_null($key)) {
         return null;
     }
     return config('quickcms.qiniu_url') . '/' . $key;
 }
开发者ID:loopeer,项目名称:quickcms,代码行数:12,代码来源:QiniuUtil.php

示例4: index

 /**
  * @param string $model The model to list.
  * @return mixed
  */
 public function index(Request $request, $model)
 {
     if (!Auth::check()) {
         return response("Unauthorised", 401);
     }
     $user = Auth::user();
     if ($user->cannot('administrate')) {
         return response("Unauthorised", 401);
     }
     $class = $this->getModel($model);
     if (is_null($class)) {
         return response("No items found for this model {$model}", 404);
     }
     $pagination_enabled = config('crudapi.pagination.enabled');
     $perPage = config('crudapi.pagination.perPage');
     if ($pagination_enabled) {
         $items = $class->paginate($perPage);
     } else {
         $items = $class->all();
     }
     $fields = $class->getFillable();
     $data = $this->buildData();
     $data['items'] = $items;
     $data['model'] = $model;
     $data['fields'] = $fields;
     $data['uiframework'] = config('crudapi.framework', 'bs3');
     $data['timestamps'] = config('crudapi.admin.showTimestamps', false);
     $data['show_ids'] = config('crudapi.admin.showIds', false);
     return view('crudapi::admin.index', $data);
 }
开发者ID:azhany,项目名称:crud-api,代码行数:34,代码来源:AdminController.php

示例5: failedValidation

 protected function failedValidation(Validator $validator)
 {
     if (config('app.debug') || Request::is("api/*")) {
         throw new ValidationException($validator);
     }
     return parent::failedValidation($validator);
 }
开发者ID:MetropoliaUAS,项目名称:ISDProject-Online,代码行数:7,代码来源:Request.php

示例6: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     // Add the TransLaravel service provider
     $this->info('Publishing assets...');
     $this->info(\Artisan::call('vendor:publish'));
     //, ['--provider' => 'deArgonauten/TransLaravel\TransLaravelServiceProvider', '--force' => true]);
     $this->info('Done!');
     // Do the migrations
     $this->info('Migrating translations...');
     $this->info(\Artisan::call('migrate', ['--path' => 'vendor/deArgonauten/TransLaravel/src/migrations', '--force' => true]));
     $this->info('Done!');
     $fallback_locale = config('app.fallback_locale');
     $locale = config('app.locale');
     if (!$this->confirm('Is ' . $fallback_locale . ' the correct fallback locale? [y|N]')) {
         $this->info('Please correct the config in config/app.php.');
         if (!$this->confirm('Did you correct te locale? [y|N]')) {
             $this->info('Quite stubborn, eh? We will proceed.');
         }
     }
     // Install middleware.
     $this->addServiceProvider();
     if ($this->confirm('Do you want to have your routes translated? [y|N]')) {
         // Install middleware.
         $this->addMiddleware();
     }
     $this->info('All done!');
 }
开发者ID:deargonauten,项目名称:translaravel,代码行数:32,代码来源:InstallTransLaravel.php

示例7: __construct

 public function __construct()
 {
     $this->middleware('ipblocked');
     $driver = config('database.default');
     $database = config('database.connections');
     $this->db = $database[$driver]['database'];
     $this->dbuser = $database[$driver]['username'];
     $this->dbpass = $database[$driver]['password'];
     $this->dbhost = $database[$driver]['host'];
     if (\Auth::check() == true) {
         if (!\Session::get('gid')) {
             \Session::put('uid', \Auth::user()->id);
             \Session::put('gid', \Auth::user()->group_id);
             \Session::put('eid', \Auth::user()->email);
             \Session::put('ll', \Auth::user()->last_login);
             \Session::put('fid', \Auth::user()->first_name . ' ' . \Auth::user()->last_name);
             \Session::put('themes', 'sximo-light-blue');
         }
     }
     if (!\Session::get('themes')) {
         \Session::put('themes', 'sximo');
     }
     if (defined('CNF_MULTILANG') && CNF_MULTILANG == 1) {
         $lang = \Session::get('lang') != "" ? \Session::get('lang') : CNF_LANG;
         \App::setLocale($lang);
     }
     $data = array('last_activity' => strtotime(Carbon::now()));
     \DB::table('tb_users')->where('id', \Session::get('uid'))->update($data);
 }
开发者ID:Gadurp1,项目名称:Final-420-Project,代码行数:29,代码来源:Controller.php

示例8: __construct

 public function __construct()
 {
     $request = App::make(\Illuminate\Http\Request::class);
     $this->middleware('web');
     $this->middleware('auth.role:admin');
     $this->setupTheme(config('theme.themes.user.theme'), config('theme.themes.user.layout'));
 }
开发者ID:dhaval48,项目名称:cms,代码行数:7,代码来源:UserController.php

示例9: register

 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     $this->app->bind('Usman\\Guardian\\Repositories\\Interfaces\\RoleRepositoryInterface', function () {
         $role = config('guardian.roleModel');
         return new RoleRepository(new $role());
     });
 }
开发者ID:aamirchaudhary,项目名称:guardian,代码行数:12,代码来源:RoleRepositoryServiceProvider.php

示例10: index

 public function index(Request $request)
 {
     $parameters = $request->route()->parameters();
     $parser = new Parser($parameters);
     $generator = new Generator($request->path());
     if (!isset($parameters['version']) && !isset($parameters['resource']) && !isset($parameters['action'])) {
         $segments = ['index'];
     } else {
         $segments = $parameters;
     }
     $file = base_path('resources/' . config('apidocu.base') . '/' . implode('/', $segments) . '.md');
     if (file_exists($file)) {
         $content = file_get_contents($file);
         $status = 200;
     } else {
         $status = 404;
         switch (config('apidocu.404.type')) {
             case 'text':
                 $content = config('apidocu.404.value');
                 break;
             case 'view':
                 $content = view(config('apidocu.404.value'));
                 break;
             default:
                 $content = '**404 - page not found**';
                 break;
         }
     }
     $content = $parser->parse($content);
     return Response::make(view('apidocu::index')->with(['navigation' => $generator->navigation(), 'breadcrumb' => $generator->breadcrumb(), 'content' => $content]), $status);
 }
开发者ID:Absolute-Software,项目名称:laravel-apidocu,代码行数:31,代码来源:DocumentationController.php

示例11: register

 public function register()
 {
     $this->app->bind('googleSearch', function () {
         $googlesearchConfig = config('googleSearch');
         return new GoogleSearch($googlesearchConfig['searchEngineId']);
     });
 }
开发者ID:kkallasm,项目名称:googlesearch,代码行数:7,代码来源:GoogleSearchServiceProvider.php

示例12: register

 /**
  * Register service provider.
  *
  * @return void
  */
 public function register()
 {
     $this->mergeConfigFrom(__DIR__ . '/config.php', 'geography');
     // Http
     switch (config('geography.services.http.implementation')) {
         case 'Guzzle':
             $this->app->bind('Maxyc\\Laravel\\Geography\\Services\\Http\\HttpInterface', 'Maxyc\\Laravel\\Geography\\Services\\Http\\GuzzleHttp');
             break;
     }
     $this->app->bind('http', 'Maxyc\\Laravel\\Geography\\Services\\Http\\HttpInterface');
     // Countries
     switch (config('geography.services.countries.implementation')) {
         case 'Geonames':
             $this->app->bind('Maxyc\\Laravel\\Geography\\Services\\Countries\\CountriesInterface', 'Maxyc\\Laravel\\Geography\\Services\\Countries\\GeonamesCountries');
             break;
     }
     $this->app->bind('countries', 'Maxyc\\Laravel\\Geography\\Services\\Countries\\CountriesInterface');
     // Location
     switch (config('geography.services.location.implementation')) {
         case 'Telize':
             $this->app->bind('Maxyc\\Laravel\\Geography\\Services\\Location\\LocationInterface', 'Maxyc\\Laravel\\Geography\\Services\\Location\\TelizeLocation');
             break;
         case 'Ipapi':
             $this->app->bind('Maxyc\\Laravel\\Geography\\Services\\Location\\LocationInterface', 'Maxyc\\Laravel\\Geography\\Services\\Location\\IpapiLocation');
             break;
     }
     $this->app->bind('location', 'Maxyc\\Laravel\\Geography\\Services\\Location\\LocationInterface');
     // Phones
     switch (config('geography.services.phones.implementation')) {
         case 'Restcountries':
             $this->app->bind('Maxyc\\Laravel\\Geography\\Services\\Phones\\PhonesInterface', 'Maxyc\\Laravel\\Geography\\Services\\Phones\\RestcountriesPhones');
             break;
     }
     $this->app->bind('phones', 'Maxyc\\Laravel\\Geography\\Services\\Phones\\PhonesInterface');
 }
开发者ID:maxyc,项目名称:geolara,代码行数:40,代码来源:ServiceProvider.php

示例13: map

 /**
  * Define the routes for the application.
  *
  * @param \Illuminate\Routing\Router $router
  *
  * @return void
  */
 public function map(Router $router)
 {
     $router->group(['namespace' => $this->namespace], function (Router $router) {
         /*
          * Front office routes
          */
         if ($page = TypiCMS::getPageLinkedToModule('galleries')) {
             $options = $page->private ? ['middleware' => 'auth'] : [];
             foreach (config('translatable.locales') as $lang) {
                 if ($page->translate($lang)->status && ($uri = $page->uri($lang))) {
                     $router->get($uri, $options + ['as' => $lang . '.galleries', 'uses' => 'PublicController@index']);
                     $router->get($uri . '/{slug}', $options + ['as' => $lang . '.galleries.slug', 'uses' => 'PublicController@show']);
                 }
             }
         }
         /*
          * Admin routes
          */
         $router->get('admin/galleries', 'AdminController@index')->name('admin::index-galleries');
         $router->get('admin/galleries/create', 'AdminController@create')->name('admin::create-gallery');
         $router->get('admin/galleries/{gallery}/edit', 'AdminController@edit')->name('admin::edit-gallery');
         $router->post('admin/galleries', 'AdminController@store')->name('admin::store-gallery');
         $router->put('admin/galleries/{gallery}', 'AdminController@update')->name('admin::update-gallery');
         /*
          * API routes
          */
         $router->get('api/galleries', 'ApiController@index')->name('api::index-galleries');
         $router->put('api/galleries/{gallery}', 'ApiController@update')->name('api::update-gallery');
         $router->delete('api/galleries/{gallery}', 'ApiController@destroy')->name('api::destroy-gallery');
     });
 }
开发者ID:webfactorybulgaria,项目名称:Galleries,代码行数:38,代码来源:RouteServiceProvider.php

示例14: process

 /**
  * Process password forgotten
  * 
  * @access public
  * @return void
  */
 public function process()
 {
     $email_address = $this->input->post('email_address');
     if (validate_email_address($email_address)) {
         //load model
         $this->load->model('account_model');
         $data = $this->account_model->get_data($email_address);
         if ($data !== NULL) {
             $password = create_random_string(config('ACCOUNT_PASSWORD'));
             if ($this->account_model->save_password($data['customers_id'], $password)) {
                 $this->load->library('email_template');
                 $email = $this->email_template->get_email_template('password_forgotten');
                 $email->set_data($data['customers_firstname'], $data['customers_lastname'], getenv('REMOTE_ADDR'), $password, $data['customers_gender'], $data['customers_email_address']);
                 $email->build_message();
                 $email->send_email();
                 $this->message_stack->add_session('login', lang('success_password_forgotten_sent'), 'success');
                 redirect('account/login');
             }
         } else {
             $this->message_stack->add('password_forgotten', lang('error_password_forgotten_no_email_address_found'));
         }
     } else {
         $this->message_stack->add('password_forgotten', lang('error_password_forgotten_no_email_address_found'));
     }
     $this->template->build('account/password_forgotten');
 }
开发者ID:colonia,项目名称:tomatocart-v2,代码行数:32,代码来源:password_forgotten.php

示例15: getPrimaryField

 /**
  * Retrieve the models primary field for display purposes.
  *
  * @param            $item   Model to retrieve primary field of
  * @param null|array $config CrudApi Configuration
  *
  * @return string
  */
 public function getPrimaryField($item, $config = null)
 {
     /* If config is not overridden then load crudapi config */
     if ($config === null) {
         $config = config('crudapi');
     }
     if (!isset($config['models']['fields']['default'])) {
         $defaultField = 'name';
     } else {
         $defaultField = $config['models']['fields']['default'];
     }
     /* Get the items Class */
     $class = get_class($item);
     $stripped_class = str_replace($this->crudApi->namespace, '', $class);
     // if class starts with a \ remove it.
     if (substr($stripped_class, 0, 1) == '\\') {
         $stripped_class = substr($stripped_class, 1);
     }
     $primaryFields = $config['models']['fields']['primary'];
     if (array_key_exists($stripped_class, $primaryFields)) {
         return $primaryFields[$stripped_class];
     } else {
         //return the default
         return $defaultField;
     }
 }
开发者ID:taskforcedev,项目名称:crud-api,代码行数:34,代码来源:Field.php


注:本文中的config函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。