當前位置: 首頁>>代碼示例>>PHP>>正文


PHP App::make方法代碼示例

本文整理匯總了PHP中Illuminate\Support\Facades\App::make方法的典型用法代碼示例。如果您正苦於以下問題:PHP App::make方法的具體用法?PHP App::make怎麽用?PHP App::make使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Support\Facades\App的用法示例。


在下文中一共展示了App::make方法的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: downloadInvoice

 public function downloadInvoice($view, $id)
 {
     $brochure = App::make('walis-merchant.brochure');
     $brochure->loadView($view, InvoiceRepository::find($id));
     $filename = 'invoice_' . sha1(date("Y-n-d-His")) . '.pdf';
     return $brochure->download($filename);
 }
開發者ID:walisph,項目名稱:merchant,代碼行數:7,代碼來源:CartRepository.php

示例3: 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

示例4: 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

示例5: registerHtmlBuilder

 /**
  * Register the HTML builder instance.
  * This binds the 'html' reference in the IoC container to the package implementation.
  * Laravel's HTML Facade will automatically use this when being called
  *
  * @return void
  */
 protected function registerHtmlBuilder()
 {
     $this->app->bindShared('html', function ($app) {
         $urlGenerator = App::make(UrlGenerator::class);
         return new HtmlBuilder($urlGenerator);
     });
 }
開發者ID:inakianduaga,項目名稱:laravel-html-builder-extensions,代碼行數:14,代碼來源:LaravelHtmlBuilderExtensionsServiceProvider.php

示例6: __construct

 /**
  * @param Proxy $proxy
  * @param string $name
  */
 public function __construct(Proxy $proxy, $name = '')
 {
     self::$client = App::make('Elasticsearch');
     self::$config = App::make('Menthol\\Flexible\\Config');
     $this->setProxy($proxy);
     $this->setName($name ?: $proxy->getModel()->getTable());
 }
開發者ID:menthol,項目名稱:Flexible,代碼行數:11,代碼來源:Index.php

示例7: __construct

 public function __construct(QueryStringOperations $qso)
 {
     $this->queryStringOps = $qso;
     $this->request = App::make('request');
     $this->url = App::make('url');
     $this->config = App::make('config');
 }
開發者ID:noherczeg,項目名稱:restext,代碼行數:7,代碼來源:RestLinker.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: __construct

 public function __construct()
 {
     $this->package = \Vsch\TranslationManager\ManagerServiceProvider::PACKAGE;
     $this->packagePrefix = $this->package . '::';
     $this->manager = App::make($this->package);
     $this->cookiePrefix = $this->manager->getConfig('persistent_prefix', 'K9N6YPi9WHwKp6E3jGbx');
     $locale = Cookie::get($this->cookieName(self::COOKIE_LANG_LOCALE), \Lang::getLocale());
     App::setLocale($locale);
     $this->primaryLocale = Cookie::get($this->cookieName(self::COOKIE_PRIM_LOCALE), $this->manager->getConfig('primary_locale', 'en'));
     $this->locales = $this->loadLocales();
     $this->translatingLocale = Cookie::get($this->cookieName(self::COOKIE_TRANS_LOCALE));
     if (!$this->translatingLocale || $this->translatingLocale === $this->primaryLocale && count($this->locales) > 1) {
         $this->translatingLocale = count($this->locales) > 1 ? $this->locales[1] : $this->locales[0];
         Cookie::queue($this->cookieName(self::COOKIE_TRANS_LOCALE), $this->translatingLocale, 60 * 24 * 365 * 1);
     }
     $this->displayLocales = Cookie::has($this->cookieName(self::COOKIE_DISP_LOCALES)) ? Cookie::get($this->cookieName(self::COOKIE_DISP_LOCALES)) : implode(',', array_slice($this->locales, 0, 5));
     $this->displayLocales .= implode(',', array_flatten(array_unique(explode(',', ($this->displayLocales ? ',' : '') . $this->primaryLocale . ',' . $this->translatingLocale))));
     //$this->sqltraces = [];
     //$this->logSql = 0;
     //
     //$thisController = $this;
     //\Event::listen('illuminate.query', function ($query, $bindings, $time, $name) use ($thisController)
     //{
     //    if ($thisController->logSql)
     //    {
     //        $thisController->sqltraces[] = ['query' => $query, 'bindings' => $bindings, 'time' => $time];
     //    }
     //});
 }
開發者ID:andrei-tara,項目名稱:laravel-translation-manager,代碼行數:29,代碼來源:Controller.php

示例10: show

 /**
  * @param $id
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function show($id)
 {
     $todolist = $this->todolistRepository->byId($id);
     $javaScript = App::make('JavaScript');
     $javaScript->put(['todolist' => $todolist]);
     return view('todolist', compact('todolist'));
 }
開發者ID:burimshala,項目名稱:todoapp,代碼行數:11,代碼來源:TodolistController.php

示例11: __construct

 public function __construct()
 {
     $this->middleware('auth');
     //        $this->beforeFilter('csrf', ['on' => 'post']);
     $this->displayNameField = config('genealabs-bones-keeper.displayNameField');
     $this->user = App::make(config('auth.model'));
 }
開發者ID:janusnic,項目名稱:bones-keeper,代碼行數:7,代碼來源:AssignmentsController.php

示例12: testSlugRetrieval

 /**
  * Unfortunately we need to do an Integrated test for this particular use-case.
  */
 public function testSlugRetrieval()
 {
     $account = Account::create([]);
     App::make(AccountRepositoryInterface::class)->save($account);
     $this->assertNotEmpty($account->slug);
     $this->assertInstanceOf(Slug::class, $account->slug);
 }
開發者ID:kamaroly,項目名稱:shift,代碼行數:10,代碼來源:SluggableTest.php

示例13: __construct

 public function __construct()
 {
     $this->request = App::make('request');
     $this->config = App::make('config');
     $this->serializer = App::make('serializer');
     $this->embededResponse = App::make('Symfony\\Component\\HttpFoundation\\Response');
 }
開發者ID:noherczeg,項目名稱:restext,代碼行數:7,代碼來源:RestResponse.php

示例14: register

 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     $this->app->bind('odm.documentmanager', function ($app) {
         $conn = Config::get('laravel-odm::connection');
         return DocumentManager::create(new Connection($conn['server'], $conn['options']), App::make('odm.config'));
     });
     $this->app->bind('odm.config', function ($app) {
         $conn = Config::get('laravel-odm::connection');
         $dir = Config::get('laravel-odm::dir');
         $config = new Configuration();
         $config->setProxyDir($dir['proxy']);
         $config->setProxyNamespace('Proxies');
         $config->setHydratorDir($dir['hydrator']);
         $config->setHydratorNamespace('Hydrators');
         $config->setMetadataDriverImpl(App::make('odm.annotation'));
         $config->setDefaultDB($conn['options']['db']);
         return $config;
     });
     $this->app->bind('odm.annotation', function ($app) {
         $dir = Config::get('laravel-odm::dir');
         AnnotationDriver::registerAnnotationClasses();
         $reader = new AnnotationReader();
         return new AnnotationDriver($reader, $dir['document']);
     });
 }
開發者ID:kh411d,項目名稱:laravel-odm,代碼行數:30,代碼來源:LaravelOdmServiceProvider.php

示例15: __construct

 /**
  * Constructor for initialize Paypal.
  */
 public function __construct()
 {
     // Get Cart in Container
     $this->cart = App::make('App\\Http\\Cart\\Cart');
     $this->_apiContext = Paypal::ApiContext(config('services.paypal.client_id'), config('services.paypal.secret'));
     $this->_apiContext->setConfig(['mode' => 'sandbox', 'service.EndPoint' => 'https://api.sandbox.paypal.com', 'http.ConnectionTimeOut' => 30, 'log.LogEnabled' => true, 'log.FileName' => storage_path('logs/paypal.log'), 'log.LogLevel' => 'FINE']);
 }
開發者ID:Symfomany,項目名稱:laravelcinema,代碼行數:10,代碼來源:CartController.php


注:本文中的Illuminate\Support\Facades\App::make方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。