• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Laravel\Config类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了Config类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
 }
开发者ID:victoroliveira1605,项目名称:Laravel-Bootstrap,代码行数:26,代码来源:lang.php


示例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();
 }
开发者ID:SerdarSanri,项目名称:laravel-weed,代码行数:32,代码来源:view.php


示例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.");
     }
 }
开发者ID:gigikiri,项目名称:masjid-l3,代码行数:31,代码来源:cache.php


示例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);
     }
 }
开发者ID:cloudmanic,项目名称:php-warchest,代码行数:31,代码来源:CloudAuth.php


示例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]);
 }
开发者ID:ashicus,项目名称:apocalypse,代码行数:8,代码来源:helpers.php


示例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];
 }
开发者ID:reith2004,项目名称:components,代码行数:17,代码来源:module.php


示例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;
 }
开发者ID:acmadi,项目名称:language-builder,代码行数:18,代码来源:utilities.php


示例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']);
     }
 }
开发者ID:reith2004,项目名称:components,代码行数:10,代码来源:asset.php


示例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];
 }
开发者ID:reith2004,项目名称:components,代码行数:26,代码来源:api.php


示例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];
 }
开发者ID:reith2004,项目名称:components,代码行数:26,代码来源:dbmanager.php


示例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];
 }
开发者ID:laravelbook,项目名称:framework3,代码行数:11,代码来源:laravel_extra.php


示例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();
 }
开发者ID:cloudmanic,项目名称:php-warchest,代码行数:17,代码来源:LaravelAuth.php


示例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);
     }
 }
开发者ID:SerdarSanri,项目名称:laravel-weed,代码行数:21,代码来源:extension.php


示例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();
 }
开发者ID:farhan4648gul,项目名称:developer-side,代码行数:12,代码来源:Group.php


示例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!";
 }
开发者ID:perryhau,项目名称:Laravel-1,代码行数:18,代码来源:manager.php


示例16: listRole

 public static function listRole()
 {
     $rolelist = Role::paginate(Config::get('system.pagination'));
     $datagrid = new Datagrid();
     $datagrid->setFields(array('role' => Str::upper(Lang::line('admin.rolename')->get()), 'roledesc' => Str::upper(Lang::line('admin.roledesc')->get())));
     $datagrid->setAction(Lang::line('global.edit')->get(), 'editRoleModal', true, array('roleid'));
     //false,array('id'=>'roleid','data-toggle'=>'modal'));
     $datagrid->setAction(Lang::line('global.delete')->get(), 'deleteRole', true, array('roleid'));
     $datagrid->setContainer('list01', 'span12');
     $datagrid->setTable('users', 'table table-bordered table-hover table-striped table-condensed');
     $datagrid->build($rolelist, 'roleid');
     return $datagrid->render();
 }
开发者ID:farhan4648gul,项目名称:developer-side,代码行数:13,代码来源:Role.php


示例17: __construct

 public function __construct()
 {
     $this->server = Config::get('mail::smtp.server');
     $this->port = Config::get('mail::smtp.port');
     $this->encryption = Config::get('mail::smtp.encryption');
     $this->username = Config::get('mail::smtp.username');
     $this->password = Config::get('mail::smtp.password');
     $this->realname = Config::get('mail::smtp.realname');
     $this->transport = Swift_SmtpTransport::newInstance($this->server, $this->port, $this->encryption)->setUsername($this->username)->setPassword($this->password);
     $this->mailer = Swift_Mailer::newInstance($this->transport);
     $this->message = Swift_Message::newInstance();
     // Set default sender.
     $this->message->setFrom(array($this->username => $this->realname));
 }
开发者ID:SerdarSanri,项目名称:Mail,代码行数:14,代码来源:Mail.php


示例18: connection

 /**
  * Get a database connection.
  *
  * If no database name is specified, the default connection will be returned.
  *
  * <code>
  *		// Get the default database connection for the application
  *		$connection = DB::connection();
  *
  *		// Get a specific connection by passing the connection name
  *		$connection = DB::connection('mysql');
  * </code>
  *
  * @param  string      $connection
  * @return Database\Connection
  */
 public static function connection($connection = null)
 {
     if (is_null($connection)) {
         $connection = Config::get('database.default');
     }
     if (!isset(static::$connections[$connection])) {
         $config = Config::get("database.connections.{$connection}");
         if (is_null($config)) {
             throw new \Exception("Database connection is not defined for [{$connection}].");
         }
         static::$connections[$connection] = new Connection(static::connect($config), $config);
     }
     return static::$connections[$connection];
 }
开发者ID:bamper,项目名称:laravel.com,代码行数:30,代码来源:database.php


示例19: open

 /**
  * Open a HTML form.
  *
  * If PUT or DELETE is specified as the form method, a hidden input field will be generated
  * containing the request method. PUT and DELETE are not supported by HTML forms, so the
  * hidden field will allow us to "spoof" PUT and DELETE requests.
  *
  * Unless specified, the "accept-charset" attribute will be set to the application encoding.
  *
  * <code>
  *		// Open a "POST" form to the current request URI
  *		echo Form::open();
  *
  *		// Open a "POST" form to a given URI
  *		echo Form::open('user/profile');
  *
  *		// Open a "PUT" form to a given URI
  *		echo Form::open('user/profile', 'put');
  *
  *		// Open a form that has HTML attributes
  *		echo Form::open('user/profile', 'post', array('class' => 'profile'));
  * </code>
  *
  * @param  string   $action
  * @param  string   $method
  * @param  array    $attributes
  * @param  bool     $https
  * @return string
  */
 public static function open($action = null, $method = 'POST', $attributes = array(), $https = false)
 {
     $method = strtoupper($method);
     $attributes['method'] = static::method($method);
     $attributes['action'] = static::action($action, $https);
     if (!array_key_exists('accept-charset', $attributes)) {
         $attributes['accept-charset'] = Config::get('application.encoding');
     }
     $append = '';
     if ($method == 'PUT' or $method == 'DELETE') {
         $append = static::hidden(Request::spoofer, $method);
     }
     return '<form' . HTML::attributes($attributes) . '>' . $append . PHP_EOL;
 }
开发者ID:nshontz,项目名称:laravel-blog,代码行数:43,代码来源:form.php


示例20: listFlow

 public static function listFlow()
 {
     $allFlow = Flow::paginate(Config::get('system.pagination'));
     $datagrid = new Datagrid();
     $datagrid->setFields(array('flowname' => 'Flow'));
     $datagrid->setFields(array('created_at' => 'Created'));
     $datagrid->setFields(array('updated_at' => 'Updated'));
     $datagrid->setAction('edit', 'editFlowModal', true, array('flowid'));
     // $datagrid->setAction('delete','deleteRole',true,array('userid'));
     $datagrid->setAction('step', 'step');
     $datagrid->setTable('flows', 'table table-bordered table-hover table-striped table-condensed');
     $datagrid->build($allFlow, 'flowid');
     return $datagrid->render();
 }
开发者ID:farhan4648gul,项目名称:developer-side,代码行数:14,代码来源:Flow.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Laravel\Str类代码示例发布时间:2022-05-23
下一篇:
PHP Laravel\Bundle类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap