本文整理汇总了PHP中Illuminate\Support\Facades\App::runningInConsole方法的典型用法代码示例。如果您正苦于以下问题:PHP App::runningInConsole方法的具体用法?PHP App::runningInConsole怎么用?PHP App::runningInConsole使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\App
的用法示例。
在下文中一共展示了App::runningInConsole方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($init = false)
{
$this->filter = ['filter' => [], 'setSize' => '10', 'bookmarkKey' => ''];
if (!App::runningInConsole() || App::runningInConsole() && $init == true) {
$this->client = new NTLMSoapClient(config('levapp.navision.url'));
}
}
示例2: boot
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
if (!App::runningInConsole()) {
//código para não executar quando estamos rodando a aplicação via console
ProjectTask::created(function ($task) {
Event::fire(new TaskWasIncluded($task));
});
}
}
示例3: boot
/**
* Register any application authentication / authorization services.
*
* @param \Illuminate\Contracts\Auth\Access\Gate $gate
* @return void
*/
public function boot(GateContract $gate)
{
$this->registerPolicies($gate);
if (!App::runningInConsole()) {
foreach ($this->getPermissions() as $permission) {
$gate->define($permission->name, function ($user) use($permission) {
return $user->hasRole($permission->roles) || $user->isAdmin();
});
}
}
}
示例4: isAuditEnabled
/**
* Determine whether audit enabled.
*
* @return bool
*/
public static function isAuditEnabled()
{
if (App::runningInConsole() && !Config::get('auditing.audit_console')) {
return false;
}
return true;
}
示例5: beforeRoute
protected function beforeRoute()
{
if (App::runningInConsole()) {
return;
}
$request = request();
$locales = app('translator.manager')->getLocales();
if (!$locales) {
$locales = [app()->getLocale() => app()->getLocale()];
}
if (array_key_exists($request->segment(1), $locales)) {
$this->serverModify($request, $locales);
}
}
示例6: registerIfNotInstalled
/**
* Register the service provider.
*
* @return void
*/
private function registerIfNotInstalled()
{
$filemanager = $this->app['installer']->getFileManager();
include_once __DIR__ . '/Routes/routes.php';
if (($install = $filemanager->isInstalled()) !== false ? $filemanager->isUpdatable() : true) {
if (App::runningInConsole()) {
if ($this->allowCommand()) {
return;
}
exit('You must run command: php artisan ' . (!$install ? 'app:install' : 'app:upgrade'));
}
if (!$this->app['request']->is('Installer@*') && !$this->app['request']->is('*/Installer@*')) {
$this->redirectTo(route(!$install ? 'installer::welcome' : 'installer::upgrade'));
}
}
}
示例7:
return View::make('404');
}
});
App::error(function (InvalidOpenIdMessageException $exception, $code) {
Log::error($exception);
if (!App::runningInConsole()) {
$checkpoint_service = ServiceLocator::getInstance()->getService(UtilsServiceCatalog::CheckPointService);
if ($checkpoint_service) {
$checkpoint_service->trackException($exception);
}
return View::make('404');
}
});
App::error(function (InvalidOAuth2Request $exception, $code) {
Log::error($exception);
if (!App::runningInConsole()) {
$checkpoint_service = ServiceLocator::getInstance()->getService(UtilsServiceCatalog::CheckPointService);
if ($checkpoint_service) {
$checkpoint_service->trackException($exception);
}
return View::make('404');
}
});
/*
|--------------------------------------------------------------------------
| Maintenance Mode Handler
|--------------------------------------------------------------------------
|
| The "down" Artisan command gives you the ability to put an application
| into maintenance mode. Here, you will define what is displayed back
| to the user if maintenace mode is in effect for this application.
示例8: findOrFail
/**
* A little hack to reconnect to the database if we're in console mode and trying to find a deployment.
* Should fix the error sending STMT_PREPARE problem that causes deployments to sit "pending" forever.
* @return mixed
*/
public function findOrFail()
{
if (App::runningInConsole()) {
DB::reconnect();
}
return parent::__call('findOrFail', func_get_args());
}