本文整理汇总了PHP中app\Config::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::get方法的具体用法?PHP Config::get怎么用?PHP Config::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Config
的用法示例。
在下文中一共展示了Config::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($db_name, $db_user = 'root', $db_pass = 'root', $db_host = 'localhost')
{
$config = new Config();
if ($config != null) {
$this->db_name = $config->get("db_name");
$this->db_user = $config->get("db_user");
$this->db_pass = $config->get("db_pass");
$this->db_host = $config->get("db_host");
}
}
示例2: getRole
public static function getRole($role_id)
{
//TODO let's not call the DB here.
//return self::find($role_id);
$roles = (array) \Config::get('mycustomvars.roles');
return array_search($role_id, $roles);
}
示例3: __construct
public function __construct()
{
$adapter = Config::get('database.engine');
$this->created_at = date('Y-m-d H:i:s');
$this->update = (object) array();
$this->setAdapter(DatabaseAdapterFactory::create($adapter));
}
示例4: createFromApi
public static function createFromApi($placeId, $apiData)
{
$photo = self::create(['place_id' => $placeId, 'photo_reference' => $apiData->photo_reference, 'width' => $apiData->width, 'height' => $apiData->height]);
$response = \App\Api\Place::getPhoto($apiData->photo_reference);
file_put_contents(\Config::get('place.photo_path') . $photo->id . '.jpg', $response->getResultPhoto());
unset($response);
}
示例5: getStatsAction
public function getStatsAction()
{
$config = Config::get("kayako");
$db = new \PDO("mysql:dbname=" . $config["database"] . ";host=" . $config["host"], $config["username"], $config["password"]);
$sql = "\n SELECT ticketstatusid, ticketstatustitle, ownerstaffid, ownerstaffname, count(*) as cnt FROM `swtickets`\n WHERE departmentid in (3,4)\n GROUP BY ticketstatusid, ownerstaffid, ownerstaffname\n ";
$stats = array("status" => array("total" => 0), "user" => array("total" => 0));
foreach ($db->query($sql) as $row) {
$stats['status']["total"] += $row["cnt"];
if (!isset($stats['status'][$row["ticketstatustitle"]])) {
$stats['status'][$row["ticketstatustitle"]] = 0;
}
$stats['status'][$row["ticketstatustitle"]] += $row["cnt"];
if (!isset($stats['user'][$row["ownerstaffname"]])) {
$stats['user'][$row["ownerstaffname"]] = array("total" => 0);
}
$stats['user'][$row["ownerstaffname"]]["total"] += $row["cnt"];
if (!isset($stats['user'][$row["ownerstaffname"]][$row["ticketstatustitle"]])) {
$stats['user'][$row["ownerstaffname"]][$row["ticketstatustitle"]] = 0;
}
$stats['user'][$row["ownerstaffname"]][$row["ticketstatustitle"]] += $row["cnt"];
}
if (isset($stats['user'][''])) {
$stats['user']['Unassigned'] = $stats['user'][''];
unset($stats['user']['']);
}
header('Content-type: application/json');
echo json_encode($stats);
}
示例6: getReminderDays
/**
* Get list of number of days before expiration day
* to send reminder email to company
*
* @return array
*/
public function getReminderDays()
{
$remindOnDaysStr = \Config::get('custom.remindOnDays');
$remindOnDays = explode(',', $remindOnDaysStr);
foreach ($remindOnDays as $key => $value) {
$remindOnDays[$key] = intval(trim($value));
}
return $remindOnDays;
}
示例7: boot
/**
* Get the users' material_categories.
*
* @return MaterialCategories
*/
public static function boot()
{
parent::boot();
static::creating(function ($user) {
$key = \Config::get('app.key');
$confirmation_code = hash_hmac('sha256', str_random(40), $key);
$user->confirmation_code = $confirmation_code;
});
}
示例8: boot
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
if (\Schema::hasTable('configs')) {
$configs = \App\Config::get();
foreach ($configs as $config) {
\Config::set($config->key, $config->value);
}
}
}
示例9: isComponentReady
protected function isComponentReady($component)
{
$compoTick = Config::get($component . 'Last');
$compoTick += Config::get($component . 'Interval');
if ($compoTick <= $this->tickCnt || $compoTick - 1440 > $this->tickCnt) {
return true;
} else {
return false;
}
}
示例10: doRequest
private function doRequest($payload)
{
if ($this->guzzle == null) {
$conf = Config::get();
$baseurl = $conf["zabbix"]["url"];
$this->guzzle = new Client(array('cookies' => true, 'base_uri' => $baseurl));
}
// var_dump($payload);
$response = $this->guzzle->request('POST', 'api_jsonrpc.php', array('body' => $payload, 'headers' => array('content-type' => 'application/json-rpc')));
return $response->getBody()->getContents();
}
示例11: __construct
public function __construct()
{
try {
$this->db = new \PDO(Config::get('database.providers.pdo.host'), Config::get('database.providers.pdo.user'), Config::get('database.providers.pdo.pass'), array(\PDO::ATTR_PERSISTENT => true));
$this->db->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
$this->connected = true;
} catch (\PDOException $e) {
$this->connected = false;
die($e->getMessage());
}
}
示例12: getPermissionsIdsArr
public function getPermissionsIdsArr()
{
$permissions_rows = \DB::table(\Config::get('entrust.permission_role_table'))->where('role_id', '=', $this->id)->get(['permission_id']);
if (empty($permissions_rows)) {
return [];
}
$permissions_ids_arr = [];
foreach ($permissions_rows as $permission_row) {
$permissions_ids_arr[] = $permission_row->permission_id;
}
return $permissions_ids_arr;
}
示例13: getRolesIdsArr
public function getRolesIdsArr()
{
$roles_rows = \DB::table(\Config::get('entrust.role_user_table'))->where('user_id', '=', $this->id)->get(['role_id']);
if (empty($roles_rows)) {
return [];
}
$roles_ids_arr = [];
foreach ($roles_rows as $role_row) {
$roles_ids_arr[] = $role_row->role_id;
}
return $roles_ids_arr;
}
示例14: boot
public static function boot()
{
parent::boot();
// Hack for Entrust because it doesn't have a boot method
static::deleting(function ($user) {
if (!method_exists(Config::get('auth.model'), 'bootSoftDeletingTrait')) {
$user->roles()->sync([]);
}
return true;
});
static::bootStapler();
}
示例15: indexAction
public function indexAction()
{
header('Content-type: application/json');
$screens = Config::get('screens');
$ret = [];
foreach ($screens as $screen) {
$obj = new \stdClass();
$obj->type = $screen;
$ret[] = $obj;
}
return json_encode(array("screens" => $ret));
}