本文整理汇总了PHP中Laravel\Config::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::get方法的具体用法?PHP Config::get怎么用?PHP Config::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Laravel\Config
的用法示例。
在下文中一共展示了Config::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: line
/**
* Create a new language line instance.
*
* <code>
* // Create a new language line instance for a given line
* $line = Lang::line('validation.required');
*
* // Create a new language line for a line belonging to a bundle
* $line = Lang::line('admin::messages.welcome');
*
* // Specify some replacements for the language line
* $line = Lang::line('validation.required', array('attribute' => 'email'));
* </code>
*
* @param string $key
* @param array $replacements
* @param string $language
* @return Lang
*/
public static function line($key, $replacements = array(), $language = null)
{
if (is_null($language)) {
$language = Config::get('application.language');
}
return new static($key, $replacements, $language);
}
示例2: render
/**
* Render the view.
*
* @return string
* @throws \Exception
*/
public function render()
{
// Events
Event::fire("laravel.composing: {$this->view}", array($this));
// Buffer the output
ob_start();
try {
// array of paths where to find the views
$paths = Config::get('weed::weed.paths');
// build the Twig object
$loader = new Twig\Weed\Loader\Filesystem($paths);
// define the Twig environment
$config = array('cache' => Config::get('weed::weed.cache'), 'debug' => Config::get('weed::weed.debug'), 'auto_reload' => Config::get('weed::weed.auto_reload'));
$twig = new \Twig_Environment($loader, $config);
// register the desired extensions
foreach (Config::get('weed::weed.extensions') as $extension) {
$twig->addExtension(new $extension());
}
// output the rendered template :-)
echo $twig->render($this->template, $this->data());
} catch (\Exception $e) {
ob_get_clean();
throw $e;
}
return ob_get_clean();
}
示例3: factory
/**
* Create a new cache driver instance.
*
* @param string $driver
* @return Cache\Drivers\Driver
*/
protected static function factory($driver)
{
if (isset(static::$registrar[$driver])) {
$resolver = static::$registrar[$driver];
return $resolver();
}
switch ($driver) {
case 'apc':
return new Cache\Drivers\APC(Config::get('cache.key'));
case 'file':
return new Cache\Drivers\File(path('storage') . 'cache' . DS);
case 'memcached':
return new Cache\Drivers\Memcached(Memcached::connection(), Config::get('cache.key'));
case 'memory':
return new Cache\Drivers\Memory();
case 'redis':
return new Cache\Drivers\Redis(Redis::db());
case 'database':
return new Cache\Drivers\Database(Config::get('cache.key'));
case 'wincache':
return new Cache\Drivers\WinCache(Config::get('cache.key'));
default:
throw new \Exception("Cache driver {$driver} is not supported.");
}
}
示例4: sessioninit
public static function sessioninit()
{
// See if we have passed in a access_token and an account id.
if (Input::get('access_token') && Input::get('account_id')) {
$access_token = Input::get('access_token');
$account_id = Input::get('account_id');
} else {
// See if we have a session. If Not do something about it.
if (!Session::get('AccountId') || !Session::get('AccessToken')) {
die(header('location: ' . Config::get('site.login_url')));
}
$access_token = Session::get('AccessToken');
$account_id = Session::get('AccountId');
}
// Is this a multi tenant setup? If so set the account.
if (Config::get('cloudmanic.account')) {
if (!(self::$account = \Accounts::get_by_id($account_id))) {
$data = array('status' => 0, 'errors' => array());
$data['errors'][] = 'Account not found.';
return \Laravel\Response::json($data);
}
}
// Validate the access_token
if (!($user = Users::get_by_access_token($access_token))) {
$data = array('status' => 0, 'errors' => array());
$data['errors'][] = 'Access token not valid.';
return \Laravel\Response::json($data);
} else {
self::_do_user($user);
}
}
示例5: getFields
public static function getFields($model)
{
$excluded = Config::get('Adminify::settings.fields');
if (!isset($excluded[$model])) {
return $excluded['all'];
}
return array_merge($excluded['all'], $excluded[$model]);
}
示例6: driver
/**
* Get a module renderer driver instance.
*
* @param string $driver
*
* @return Driver
*/
public static function driver($driver = null)
{
if (is_null($driver)) {
$driver = Config::get('admin::renderer.driver');
}
if (!isset(static::$drivers[$driver])) {
static::$drivers[$driver] = static::factory($driver);
}
return static::$drivers[$driver];
}
示例7: get_files
/**
* Get files for comparision editing
*
* @param string $name
* @param string $location
* @param string $translation
* @return array
*/
public static function get_files($name, $location, $translation)
{
$path = \Laravel\Bundle::path($location);
if (!is_file($path . 'language/' . $translation . '/' . $name . '.php')) {
return null;
}
$language['from'] = (require $path . 'language/' . \Laravel\Config::get('language-builder::builder.base_lang') . '/' . $name . '.php');
$language['to'] = (require $path . 'language/' . $translation . '/' . $name . '.php');
return $language;
}
示例8: __construct
public function __construct($name)
{
parent::__construct($name);
$this->config = Config::get('thirdparty_assetcompressor::assetcompressor');
$this->config['cache_dir'] = $this->config['cache_dir'] . '/';
$this->config['cache_dir_path'] = path('public') . $this->config['cache_dir'];
if (!is_dir($this->config['cache_dir_path'])) {
mkdir($this->config['cache_dir_path']);
}
}
示例9: driver
/**
* Get a API driver instance.
*
* If no driver name is specified, the default will be returned.
*
* <code>
* // Get the default API driver instance
* $driver = API::driver();
*
* // Get a specific API driver instance by name
* $driver = API::driver('mysql');
* </code>
*
* @param string $driver
* @return API\Drivers\Driver
*/
public static function driver($driver = null)
{
if (is_null($driver)) {
$driver = Config::get('layla.' . static::$component . '.api.driver');
}
if (!isset(static::$drivers[$driver])) {
static::$drivers[$driver] = static::factory($driver);
}
return static::$drivers[$driver];
}
示例10: driver
/**
* Get a DBManager driver instance.
*
* If no driver name is specified, the default will be returned.
*
* <code>
* // Get the default DBManager driver instance
* $driver = DBManager::driver();
*
* // Get a specific DBManager driver instance by name
* $driver = DBManager::driver('mysql');
* </code>
*
* @param string $driver
* @return DBManager\Drivers\Driver
*/
public static function driver($driver = null)
{
if (is_null($driver)) {
$driver = Config::get('database.connections.' . Config::get('database.default') . '.driver');
}
if (!isset(static::$drivers[$driver])) {
static::$drivers[$driver] = static::factory($driver);
}
return static::$drivers[$driver];
}
示例11: db
public static function db($name = 'default')
{
if (!isset(static::$databases[$name])) {
if (is_null($config = Config::get("database.redis.{$name}"))) {
throw new \Exception("Redis database [{$name}] is not defined.");
}
extract($config);
static::$databases[$name] = new static($host, $port, $database);
}
return static::$databases[$name];
}
示例12: get_user
/**
* Get the user from the database table.
*
* @param array $arguments
* @return mixed
*/
protected function get_user($arguments)
{
$table = Config::get('auth.table');
return DB::table($table)->where(function ($query) use($arguments) {
$username = Config::get('auth.username');
$query->where($username, '=', $arguments['username']);
foreach (array_except($arguments, array('username', 'password', 'remember')) as $column => $val) {
$query->where($column, '=', $val);
}
})->first();
}
示例13: t
/**
* Get a language specific line
*
* @param string $key The Key to search
* @param array $subst array The values to substitute
* @param string $lang string The language
*
* @return string
*/
public function t($key, $subst = null, $lang = null)
{
if (is_null($lang)) {
$lang = Config::get('application.language', 'en_US');
}
if (is_null($subst)) {
return Lang::line($key, array())->get($lang);
} else {
parse_str($subst, $repl);
return Lang::line($key, $repl)->get($lang);
}
}
示例14: listData
public static function listData()
{
$allGroup = Group::paginate(Config::get('system.pagination'));
$datagrid = new Datagrid();
$datagrid->setFields(array('group_name' => Str::upper(Lang::line('admin.datagroup')->get())));
$datagrid->setAction(Lang::line('global.manage')->get(), 'datacontent', false);
$datagrid->setAction(Lang::line('global.edit')->get(), 'editGroup', true, array('dmid'));
$datagrid->setAction(Lang::line('global.delete')->get(), 'deleteGroup', true, array('dmid', 'group_name'));
$datagrid->setTable('dataGroup', 'table table-bordered table-hover table-striped table-condensed');
$datagrid->build($allGroup, 'dmid');
return $datagrid->render();
}
示例15: sweep
/**
* Sweep the expired sessions from storage.
*
* @param array $arguments
* @return void
*/
public function sweep($arguments = array())
{
$driver = Session::factory(Config::get('session.driver'));
// If the driver implements the "Sweeper" interface, we know that it
// can sweep expired sessions from storage. Not all drivers need be
// sweepers since they do their own.
if ($driver instanceof Sweeper) {
$lifetime = Config::get('session.lifetime');
$driver->sweep(time() - $lifetime * 60);
}
echo "The session table has been swept!";
}