本文整理汇总了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);
}
}
}
示例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')]);
}
示例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;
}
示例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);
}
示例5: failedValidation
protected function failedValidation(Validator $validator)
{
if (config('app.debug') || Request::is("api/*")) {
throw new ValidationException($validator);
}
return parent::failedValidation($validator);
}
示例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!');
}
示例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);
}
示例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'));
}
示例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());
});
}
示例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);
}
示例11: register
public function register()
{
$this->app->bind('googleSearch', function () {
$googlesearchConfig = config('googleSearch');
return new GoogleSearch($googlesearchConfig['searchEngineId']);
});
}
示例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');
}
示例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');
});
}
示例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');
}
示例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;
}
}