本文整理汇总了PHP中App\services\Config类的典型用法代码示例。如果您正苦于以下问题:PHP Config类的具体用法?PHP Config怎么用?PHP Config使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Config类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bootDb
public static function bootDb()
{
// Init Eloquent ORM Connection
$capsule = new Capsule();
$capsule->addConnection(Config::getDbConfig());
$capsule->bootEloquent();
}
示例2: testHandleRegister
public function testHandleRegister()
{
$code = $this->addCode();
// test wrong code
$this->post('/auth/register', []);
$this->assertEquals('200', $this->response->getStatusCode());
$this->checkErrorCode(AuthController::WrongCode);
// test illegal email
$this->post('/auth/register', ["code" => $code]);
$this->assertEquals('200', $this->response->getStatusCode());
$this->checkErrorCode(AuthController::IllegalEmail);
// test password to short
$shortPwd = '123';
$this->post('/auth/register', ["code" => $code, "email" => $this->email, "passwd" => $shortPwd]);
$this->assertEquals('200', $this->response->getStatusCode());
$this->checkErrorCode(AuthController::PasswordTooShort);
// test password not equal
$this->post('/auth/register', ["code" => $code, "email" => $this->email, "passwd" => $this->password, "repasswd" => $shortPwd]);
$this->assertEquals('200', $this->response->getStatusCode());
$this->checkErrorCode(AuthController::PasswordNotEqual);
// test email used
$this->post('/auth/register', ["code" => $code, "email" => $this->getExistEmail(), "passwd" => $this->password, "repasswd" => $this->password]);
$this->assertEquals('200', $this->response->getStatusCode());
$this->checkErrorCode(AuthController::EmailUsed);
// illegal register
Config::set('emailVerifyEnabled', false);
$this->post('/auth/register', ["code" => $code, "email" => $this->email, "passwd" => $this->password, "repasswd" => $this->password, "name" => "name"]);
$this->assertEquals('200', $this->response->getStatusCode());
}
示例3: getProgrammes
/**
* Get a collection of programmes listed by letter, using a cached record if it exists
* @param string $letter The letter for which to query the programmes
* @return \Illuminate\Support\Collection
*/
public function getProgrammes($letter)
{
$page = Request::get('page', 1);
return $this->cache->remember("bbc.programmes.{$letter}.page.{$page}", \Config::get('cache.remember_time'), function () use($letter) {
return $this->bbc_api_client->getProgrammes($letter);
});
}
示例4: debug
public function debug($request, $response, $args)
{
$server = ["headers" => $request->getHeaders(), "content_type" => $request->getContentType()];
$res = ["server_info" => $server, "ip" => Http::getClientIP(), "version" => Config::get('version'), "reg_count" => Check::getIpRegCount(Http::getClientIP())];
Logger::debug(json_encode($res));
return $this->echoJson($response, $res);
}
示例5: __construct
public function __construct()
{
$this->config = Config::get("mail")["mailgun"];
$this->mg = new MailgunService($this->config["key"]);
$this->domain = $this->config["domain"];
$this->sender = $this->config["sender"];
}
示例6: charge
public static function charge($token, $email, $amount)
{
$key = Config::get('stripeKey');
Stripe\Stripe::setApiKey($key);
$customer = Stripe\Customer::create(array('email' => $email, 'card' => $token));
$charge = Stripe\Charge::create(array('customer' => $customer->id, 'amount' => $amount, 'currency' => 'USD'));
return $charge;
}
示例7: checkPassword
public static function checkPassword($hashedPassword, $password)
{
$method = Config::get('pwdMethod');
if ($hashedPassword == self::passwordHash($password)) {
return true;
}
return false;
}
示例8: testDebug
public function testDebug()
{
$this->get('/debug');
$this->assertEquals('200', $this->response->getStatusCode());
$ary = json_decode($this->response->getBody(), true);
// test version
$this->assertEquals(Config::get('version'), $ary['version']);
}
示例9: sendEmailConfirmationTo
/**
* Deliver the email confirmation.
*
* @param User $user
* @return void
*/
public function sendEmailConfirmationTo(User $user)
{
$this->to = $user->email;
$this->view = 'emails.confirm';
$this->from = \Config::get('mail.from.address');
$this->name = \Config::get('mail.from.name');
$this->data = compact('user');
$this->deliver('🚗 애.카.프. 딜러회원 가입을 완료해주세요.');
}
示例10: isAbleToCheckin
public function isAbleToCheckin()
{
$last = $this->attributes['last_check_in_time'];
$hour = Config::get('checkinTime');
if ($last + $hour * 3600 < time()) {
return true;
}
return false;
}
示例11: testHash
public function testHash()
{
Config::set('pwdMethod', 'md5');
$this->hashTest();
Config::set('pwdMethod', 'sha256');
$this->hashTest();
Config::set('pwdMethod', 'default');
$this->hashTest();
}
示例12: createTokenStorage
public static function createTokenStorage()
{
switch (Config::get('tokenDriver')) {
case 'db':
return new DB();
case 'dynamodb':
return new Dynamodb();
default:
return new DB();
}
}
示例13: newSessionCache
/**
* @return Cache
*/
public static function newSessionCache()
{
switch (Config::get('session')) {
case 'redis':
return self::newRedisCache();
case 'file':
return self::newFileCache(Config::getStoragePath('/framework/sessions'));
default:
return self::newFileCache();
}
}
示例14: post
/**
* @param string $message
* @param string $type
* @param array $attachment
*/
public function post($message, $type, $attachment = [])
{
$type = \Config::get('slack.types.' . strtolower($type), \Config::get('slack.default', []));
$webHookUrl = \Config::get('slack.webHookUrl');
$client = new Client($webHookUrl, ['username' => array_get($type, 'username', 'FamarryBot'), 'channel' => array_get($type, 'channel', '#random'), 'link_names' => true, 'icon' => array_get($type, 'icon', ':smile:')]);
$messageObj = $client->createMessage();
if (!empty($attachment)) {
$attachment = new Attachment(['fallback' => array_get($attachment, 'fallback', ''), 'text' => array_get($attachment, 'text', ''), 'pretext' => array_get($attachment, 'pretext', ''), 'color' => array_get($attachment, 'color', 'good'), 'fields' => array_get($attachment, 'fields', [])]);
$messageObj->attach($attachment);
}
$messageObj->setText($message)->send();
}
示例15: registerJob
public function registerJob($jobId, $jobInfo)
{
$queueData = ['key' => \Config::get('async.key'), 'jobs' => [['id' => $jobId, 'data' => $jobInfo]]];
if (\Config::get('async.enable', false) == true) {
$auth = ["key" => \Config::get('aws.accounts.key'), "secret" => \Config::get('aws.accounts.secret'), "region" => \Config::get('aws.accounts.region')];
$sqs = new SqsClient($auth);
$sqs->{$sqs}->sendMessage(['QueueUrl' => \Config::get('async.worker.queue'), 'MessageBody' => json_encode($queueData)]);
// Log::info('Add Queue:' . json_encode($queueData));
} else {
$this->executeJob($queueData);
}
}