当前位置: 首页>>代码示例>>PHP>>正文


PHP Facades\App类代码示例

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


在下文中一共展示了App类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: api

 /**
  * Get the API ancestor controller class
  * of the current controller class.
  *
  * @return Esensi\Core\Http\Controllers\ApiController
  */
 public function api()
 {
     // Make a copy of the parent class
     $class = get_parent_class();
     $parent = App::make($class);
     // Copy over the packaged properties
     if ($this instanceof PackagedInterface) {
         $parent->setUI($this->getUI());
         $parent->setPackage($this->getPackage());
         $parent->setNamespacing($this->getNamespacing());
     }
     // Copy over the injected repositories
     if ($this instanceof RepositoryInjectedInterface) {
         foreach ($this->repositories as $name => $repository) {
             $parent->setRepository($repository, $name);
         }
     }
     // Return first ApiController ancestor found
     if (str_contains($class, 'ApiController')) {
         return $parent;
     }
     // Recursively look up the parent class
     if (method_exists($parent, 'api')) {
         return $parent->api();
     }
     // Return the parent class found already
     return $parent;
 }
开发者ID:esensi,项目名称:core,代码行数:34,代码来源:ApiAncestryControllerTrait.php

示例2: testCommands

 /**
  * Do the Artisan commands fire?
  */
 public function testCommands()
 {
     $self = $this;
     $this->prepareSpecify();
     $this->specify('Boots', function () use($self) {
         $target = $self->getProvider(['package']);
         $target->shouldReceive('package');
         $target->boot();
     });
     $this->prepareSpecify();
     $this->specify('Identifies provisions', function () use($self) {
         $target = $self->getProvider();
         verify($target->provides())->notEmpty();
     });
     $this->prepareSpecify();
     $this->specify('Binds to application', function () use($self) {
         App::shouldReceive('bind')->with('/^toolbox\\.commands\\./', Mockery::on(function ($closure) {
             $command = $closure();
             verify_that('is a command', is_a($command, 'Illuminate\\Console\\Command'));
             return true;
         }));
         Event::shouldReceive('listen')->with('toolbox.build', Mockery::on(function ($closure) {
             $app = Mockery::mock('Illuminate\\Console\\Application[call]');
             $app->shouldReceive('call');
             $command = $closure($app);
             return true;
         }));
         $target = $self->getProvider(['commands']);
         $target->shouldReceive('commands')->with(Mockery::type('array'));
         $target->register();
     });
 }
开发者ID:impleri,项目名称:laravel-toolbox,代码行数:35,代码来源:ProviderTest.php

示例3: setSupportedLanguage

 /**
  * @param string $lang
  */
 private function setSupportedLanguage($lang)
 {
     if ($this->isLanguageSupported($lang)) {
         App::setLocale($lang);
         Session::put('lang', $lang);
     }
 }
开发者ID:Tjoosten,项目名称:refugee,代码行数:10,代码来源:Language.php

示例4: getReset

 /**
  * Display the password reset view for the given token.
  *
  * @param  string  $token
  * @return \Response
  */
 public function getReset($token = null)
 {
     if (is_null($token)) {
         App::abort(404);
     }
     $this->view('password.reset', ['token' => $token]);
 }
开发者ID:jacobDaeHyung,项目名称:laravel-tricks,代码行数:13,代码来源:RemindersController.php

示例5: display

 /**
  * Display the content of the page
  *
  * @param $query
  * @return \Illuminate\View\View
  */
 public function display($query)
 {
     $title = 'TestView';
     $page = "";
     $arr = explode('/', $query);
     // \App\Page::find(4)->content->find(5)->element->module->name
     $heading = \App\Node::findBySlug('header');
     //        dd(\App\Node::findBySlug($arr[0])->content);
     // test
     $content = \App\Node::active()->findBySlug($arr[0])->content;
     foreach ($content as $item) {
         // get the module Name of
         //            $module = \App\Module::findOrFail($p->module_id);
         // resolve the Module Name out of the IOC Container and render the content partiall
         //            $content .= App::make('module:' . $module->name)->render($p->content_id);
         //            foreach ($item->content as $content)
         //            {
         //Todo check if Module is Active and Content is Active
         $module = $item->element->module->name;
         if ($module != 'Heading') {
             continue;
         }
         // resolve the Module out of the IOC Container and render the partial
         $page .= App::make('module:' . strtolower($module))->render($item->element->row);
         //            }
     }
     return view('layout.master', compact('title', 'page'));
 }
开发者ID:beta2cms,项目名称:beta2cms,代码行数:34,代码来源:NodeController.php

示例6: getTraining

 public function getTraining()
 {
     $training = new \Offside\Team\Training($this->trainingRepository);
     $javascript = App::make('Javascript');
     $javascript::put(['attackTraining' => $training->getAttackDateTime(), 'midfieldTraining' => $training->getMidfieldDateTime(), 'defenseTraining' => $training->getDefenseDateTime(), 'anyTrainingActive' => !$training->allTrainingsDone(), 'elapsedTime' => $training->getElapsedTime()]);
     return view("my-team.training");
 }
开发者ID:burimshala,项目名称:fantasyfootball,代码行数:7,代码来源:TeamController.php

示例7: bootSilverstripe

    protected function bootSilverstripe($url = null)
    {
        $flush = $this->option('flush');
        // to allow the Silverstripe command line to know what the server URL should be ...
        // sadly, setting a global $_FILE_TO_URL_MAPPING variable is not enough because Silverstripe's Core.php (or
        // Constants.php in newer versions) doesn't declare it as global - it assumes it's declared in the
        // _ss_environment.php file which is _included_ not _required_. Boo.
        //        global $_FILE_TO_URL_MAPPING;
        //        $_FILE_TO_URL_MAPPING[base_path()] = Config::get('app.url');
        $base = base_path();
        $envPath = $base . '/_ss_environment.php';
        if (!file_exists($envPath)) {
            $appUrl = Config::get('app.url');
            file_put_contents($envPath, <<<EOT
<?php
global \$_FILE_TO_URL_MAPPING;
\$_FILE_TO_URL_MAPPING['{$base}'] = '{$appUrl}';
EOT
);
            App::shutdown(function ($app) use($envPath) {
                unlink($envPath);
            });
        }
        // taken from silverstripe's framework/cli-script.php
        if ($flush) {
            $_REQUEST['flush'] = $flush === true ? 1 : $flush;
            $_GET['flush'] = $flush === true ? 1 : $flush;
        }
        if ($url) {
            $_REQUEST['url'] = $url;
            $_GET['url'] = $url;
        }
        Silverstripe::start();
    }
开发者ID:helpfulrobot,项目名称:themonkeys-laravel-silverstripe,代码行数:34,代码来源:SilverstripeCommand.php

示例8: handle

 /**
  * Handle the command
  *
  * @param BaseCommand|RegisterUserCommand $command
  *
  * @return mixed
  */
 public function handle(BaseCommand $command)
 {
     $user = new User($command->all());
     $user->save();
     App::make('Altwallets\\Services\\UserMailer')->sendRegistrationEmail($user);
     return $user;
 }
开发者ID:virtualvendors,项目名称:altwallets,代码行数:14,代码来源:RegisterUserCommandHandler.php

示例9: register

 /**
  * Register the application services.
  *
  * @return void
  */
 public function register()
 {
     $this->mergeConfigFrom(__DIR__ . '/../../config/smsc.php', 'smsc');
     App::bind('smsc', function () {
         return new Smsc();
     });
 }
开发者ID:coder-studio,项目名称:smsc,代码行数:12,代码来源:SmscServiceProvider.php

示例10: it_should_fire_job_with_unresolvable_models

 /**
  * @test
  */
 public function it_should_fire_job_with_unresolvable_models()
 {
     /**
      *
      * Set
      *
      */
     App::shouldReceive('make')->with('menthol.flexible.proxy', Mockery::any())->once()->andReturn('mock');
     $app = m::mock('Illuminate\\Foundation\\Application');
     $config = m::mock('Menthol\\Flexible\\Config');
     $logger = m::mock('Monolog\\Logger');
     $job = m::mock('Illuminate\\Queue\\Jobs\\Job');
     $models = ['Husband:99999'];
     /**
      *
      * Expectation
      *
      */
     $logger->shouldReceive('info')->with('Indexing Husband with ID: 99999');
     $logger->shouldReceive('error')->with('Indexing Husband with ID: 99999 failed: No query results for model [Husband].');
     $config->shouldReceive('get')->with('logger', 'menthol.flexible.logger')->andReturn('menthol.flexible.logger');
     $app->shouldReceive('make')->with('menthol.flexible.logger')->andReturn($logger);
     $job->shouldReceive('delete')->once();
     $job->shouldReceive('release')->with(60)->once();
     /**
      *
      * Assertion
      *
      */
     with(new ReindexJob($app, $config))->fire($job, $models);
 }
开发者ID:menthol,项目名称:Flexible,代码行数:34,代码来源:ReindexJobTest.php

示例11: __construct

 public function __construct()
 {
     $this->request = App::make('request');
     $this->config = App::make('config');
     $this->restResponse = App::make('Noherczeg\\RestExt\\Services\\ResponseComposer');
     $this->linker = App::make('Noherczeg\\RestExt\\Services\\Linker');
     $this->restExt = App::make('Noherczeg\\RestExt\\RestExt');
     if ($this->accessPolicy === null) {
         $this->accessPolicy = $this->config->get('restext::access_policy');
     }
     // if we set the property it should override the Accept Header even if it it is set otherwise in the configs
     if ($this->produces !== null) {
         $this->produce($this->produces);
     }
     $securityRoles = $this->securityRoles;
     $accessPolicy = $this->accessPolicy;
     // Default actions
     $this->beforeFilter(function () use($securityRoles, $accessPolicy) {
         // To prevent processing / returning of content if by default the access policy is set to
         // "whitelist" and no allowed roles have been set.
         if ($accessPolicy == 'whitelist' && count($securityRoles) == 0) {
             throw new PermissionException();
         }
         // If the "prefer_accept" configuration is set to true, we set RestResponse to send the MediaType given in
         // the Accept Header if it's compatible with our system. If not we set it to the default config's value.
         if ($this->config->get('restext::prefer_accept')) {
             if (in_array($this->requestAccepts(), $this->restResponse->getSupportedMediaTypes())) {
                 $this->restResponse->setMediaType($this->requestAccepts());
             }
             $this->restResponse->setMediaType($this->config->get('restext::media_type'));
         }
     });
 }
开发者ID:noherczeg,项目名称:restext,代码行数:33,代码来源:RestExtController.php

示例12: __construct

 /**
  * Profiler constructor.
  */
 public function __construct()
 {
     $this->profiler = App::make('profiler');
     if ($this->profiler instanceof NullProfiler) {
         abort(500, 'Profiler is not instantiate correctly.');
     }
 }
开发者ID:ndrx-io,项目名称:profiler-laravel,代码行数:10,代码来源:Profiler.php

示例13: testCreateThrowsExceptionWhenMissingDefaultConfiguration

 /**
  * @expectedException \Publiux\laravelcdn\Exceptions\MissingConfigurationException
  */
 public function testCreateThrowsExceptionWhenMissingDefaultConfiguration()
 {
     $configurations = ['default' => ''];
     $m_aws_s3 = M::mock('Publiux\\laravelcdn\\Providers\\AwsS3Provider');
     \Illuminate\Support\Facades\App::shouldReceive('make')->once()->andReturn($m_aws_s3);
     $this->provider_factory->create($configurations);
 }
开发者ID:publiux,项目名称:laravelcdn,代码行数:10,代码来源:ProviderFactoryTest.php

示例14: getIconAttribute

 /**
  * Returns an html icon class of the type of
  * notification by retrieving it from the configuration file.
  *
  * @return string|null
  */
 public function getIconAttribute()
 {
     $class = $this->attributes['notifiable_type'];
     /*
      * Resolve the configuration service from the IoC since
      * we don't want to override the Notification models constructor
      * to inject the service
      */
     $config = App::make(ConfigService::class);
     // Make sure we have an instance of the ConfigService returned by the IoC
     if ($config instanceof ConfigService) {
         $icon = $config->setPrefix('maintenance')->get("notifications.icons.{$class}");
         // Return the models notification icon if it's found
         if (is_string($icon) && !empty($icon)) {
             return $icon;
         }
         /*
          * Looks like the notification icon could not be
          * found, we'll return the default notification icon
          */
         $defaultIcon = $config->setPrefix('maintenance')->get('notifications.icons.default');
         return $defaultIcon;
     }
     return;
 }
开发者ID:stevebauman,项目名称:maintenance,代码行数:31,代码来源:Notification.php

示例15: register

 /**
  * Register any package services.
  *
  * @return void
  */
 public function register()
 {
     App::bind('VKAPI', function () {
         return new VKAPIClass(config('VKAPI.access_token'), config('VKAPI.version'), config('VKAPI.api_url'));
     });
     $this->publishes([__DIR__ . '/../config/VKAPI.php' => config_path('VKAPI.php')]);
 }
开发者ID:bafoed,项目名称:laravel-vkapi,代码行数:12,代码来源:VKAPIServiceProvider.php


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