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


PHP View\Factory类代码示例

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


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

示例1: __construct

 /**
  * construct.
  *
  * @param \Illuminate\Contracts\Mail\Mailer  $mailer
  * @param \Illuminate\Filesystem\Filesystem  $filesystem
  * @param \Illuminate\Contracts\View\Factory $viewFactory
  */
 public function __construct(MailerContract $mailer, Filesystem $filesystem, ViewFactory $viewFactory)
 {
     $this->mailer = $mailer;
     $this->filesystem = $filesystem;
     $this->viewFactory = $viewFactory;
     $this->viewFactory->addNamespace($this->viewNamespace, $this->storagePath());
 }
开发者ID:recca0120,项目名称:laravel-email-template,代码行数:14,代码来源:Mailer.php

示例2: place

 public function place(Order $orderModel, OrderItem $orderItem, CheckoutService $checkoutService, Factory $factory)
 {
     if (!Session::has('cart')) {
         return false;
     }
     $cart = Session::get('cart');
     if ($cart->getTotal() > 0) {
         $order = $orderModel->create(['user_id' => Auth::user()->id, 'total' => $cart->getTotal()]);
         // Criação da classe de checkout para integração com o pagseguro
         //$checkout = $checkoutService->createCheckoutBuilder();
         foreach ($cart->all() as $k => $item) {
             $order->items()->create(['product_id' => $k, 'price' => $item['price'], 'qtd' => $item['qtd']]);
             //$checkout->addItem(new Item($k, $item['name'], number_format($item['price'], 2, '.', ''), $item['qtd']));
         }
         $cart->clear();
         event(new CheckoutEvent(Auth::user(), $order));
         // Na verdade esse lugar não é exatamente o melhor lugar para se colocar o redirecionamento para
         // o pagseguro, porém por hora irá servir;
         //$response = $checkoutService->checkout($checkout->getCheckout());
         //return view('store.checkout', compact('order'));
         return view('store.checkout', ['order' => $order, 'cart' => 'vazio']);
         //return redirect($response->getRedirectionUrl());
     }
     return $factory->make('store.checkout', ['cart' => 'empty']);
     //return view('store.checkout', ['cart' => 'empty']);
 }
开发者ID:shuttzz,项目名称:laravel-commerce,代码行数:26,代码来源:CheckoutController.php

示例3: boot

 public function boot(Factory $view)
 {
     $this->loadViewsFrom(__DIR__ . '/Views', 'toolbox');
     $this->publishes([__DIR__ . '/Views' => base_path('resources/views/vendor/toolbox')]);
     // We need to register our view composer for errorPartial to properly set all variables
     $view->composer('vendor.toolbox.errors.errorPartial', ErrorPartialComposer::class);
 }
开发者ID:msivia,项目名称:Toolbox,代码行数:7,代码来源:ErrorPartialServiceProvider.php

示例4: boot

 /**
  * Bootstrap the application services.
  */
 public function boot(Router $router, ViewFactory $view)
 {
     $view->addNamespace('admin', resource_path('views/admin'));
     // route model binding for admin routes
     $router->model('content_page', Page::class);
     $this->bootAdminRoutes($router);
 }
开发者ID:unstoppablecarl,项目名称:laravel-content-pages-example,代码行数:10,代码来源:PagesServiceProvider.php

示例5: execute

 /**
  * {@inheritdoc}
  */
 public function execute($request)
 {
     /** @var $request ObtainCreditCard */
     if (false == $this->supports($request)) {
         throw RequestNotSupportedException::createActionNotSupported($this, $request);
     }
     if ($this->request->isMethod('POST')) {
         $creditCard = new CreditCard();
         $creditCard->setHolder($this->request->get('card_holder'));
         $creditCard->setNumber($this->request->get('card_number'));
         $creditCard->setSecurityCode($this->request->get('card_cvv'));
         $creditCard->setExpireAt(new DateTime($this->request->get('card_expire_at')));
         $request->set($creditCard);
         return;
     }
     $form = $this->viewFactory->make($this->templateName, ['model' => $request->getModel(), 'firstModel' => $request->getFirstModel(), 'actionUrl' => $request->getToken() ? $request->getToken()->getTargetUrl() : null]);
     throw new HttpResponse(new Response($form->render(), 200, ['Cache-Control' => 'no-store, no-cache, max-age=0, post-check=0, pre-check=0', 'X-Status-Code' => 200, 'Pragma' => 'no-cache']));
     /*
         $content = $this->viewFactory->make($this->templateName, [
             'model'      => $request->getModel(),
             'firstModel' => $request->getFirstModel(),
             'form'       => $form->render(),
             'actionUrl'  => $request->getToken() ? $request->getToken()->getTargetUrl() : null,
         ]);
     
         $this->gateway->execute($renderTemplate);
     
         throw new HttpResponse(new Response($renderTemplate->getResult(), 200, [
             'Cache-Control' => 'no-store, no-cache, max-age=0, post-check=0, pre-check=0',
             'X-Status-Code' => 200,
             'Pragma'        => 'no-cache',
         ]));
     */
 }
开发者ID:recca0120,项目名称:laravel-payum,代码行数:37,代码来源:ObtainCreditCardAction.php

示例6: viewAction

 /**
  * @param int    $tagId
  * @param string $tagName
  *
  * @throws \Illuminate\Database\Eloquent\ModelNotFoundException
  *
  * @return \Illuminate\Contracts\View\View|\Illuminate\Http\RedirectResponse
  */
 public function viewAction(int $tagId, string $tagName)
 {
     $tag = $this->tagRepository->loadById($tagId);
     if ($tag->name !== $tagName) {
         return $this->responseFactory->redirectToRoute('tag.view', ['id' => $tag->id, $tag->name]);
     }
     return $this->viewFactory->make('customer.tag.view', compact('tag'));
 }
开发者ID:hughgrigg,项目名称:ching-shop,代码行数:16,代码来源:TagController.php

示例7: handle

 public function handle(CheckPageExistsCommand $command)
 {
     $page = $this->pageFactory->create($command->getUri(), $command->getNamespace());
     if (!($exist = $this->view->exists($page->getPath()))) {
         $exist = $this->view->exists($page->getIndexPath());
     }
     return $exist;
 }
开发者ID:hscale,项目名称:fizl-pages,代码行数:8,代码来源:CheckPageExistsCommandHandler.php

示例8: generate

 public function generate()
 {
     $files = $this->documentation->getAllFiles();
     $view = $this->viewFactory->make('documentation::route_templates.routes', compact('files'));
     $filePath = storage_path() . "/routes/documentation_routes.php";
     $fileContents = "<?php\n\n" . $view->render();
     $this->finder->put($filePath, $fileContents);
 }
开发者ID:Houbsi,项目名称:Website,代码行数:8,代码来源:DocumentationRoutesGenerator.php

示例9: render

 /**
  * @param Request $request
  * @param array $routeParams
  * @return \Psr\Http\Message\ResponseInterface|EmptyResponse
  */
 public function render(Request $request, array $routeParams = [])
 {
     $view = $this->view->make('flarum.install::app');
     $view->logo = $this->view->make('flarum.install::logo');
     $errors = [];
     if (version_compare(PHP_VERSION, '5.5.0', '<')) {
         $errors[] = ['message' => '<strong>PHP 5.5+</strong> is required.', 'detail' => 'You are running version ' . PHP_VERSION . '. Talk to your hosting provider about upgrading to the latest PHP version.'];
     }
     foreach (['mbstring', 'pdo_mysql', 'openssl', 'json', 'gd', 'dom'] as $extension) {
         if (!extension_loaded($extension)) {
             $errors[] = ['message' => 'The <strong>' . $extension . '</strong> extension is required.'];
         }
     }
     $paths = [public_path(), public_path() . '/assets', storage_path()];
     foreach ($paths as $path) {
         if (!is_writable($path)) {
             $errors[] = ['message' => 'The <strong>' . realpath($path) . '</strong> directory is not writable.', 'detail' => 'Please chmod this directory ' . ($path !== public_path() ? ' and its contents' : '') . ' to 0775.'];
         }
     }
     if (count($errors)) {
         $view->content = $this->view->make('flarum.install::errors');
         $view->content->errors = $errors;
     } else {
         $view->content = $this->view->make('flarum.install::install');
     }
     return $view;
 }
开发者ID:utkarshx,项目名称:core,代码行数:32,代码来源:IndexAction.php

示例10: handle

 /**
  * Handle an incoming request.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->app->isDownForMaintenance()) {
         return new Response($this->view->make('maintenance')->render(), 503);
     }
     return $next($request);
 }
开发者ID:berkapavel,项目名称:CMS,代码行数:15,代码来源:CheckForMaintenanceMode.php

示例11: registerViewExtension

 protected function registerViewExtension()
 {
     $hasExtension = in_array('stub', $this->view->getExtensions(), true);
     if ($hasExtension === false) {
         $this->view->addExtension('stub', 'blade');
     }
 }
开发者ID:codexproject,项目名称:core,代码行数:7,代码来源:ProjectGenerator.php

示例12: render

 /**
  * @param Append $append
  *
  * @return \Illuminate\Contracts\View\View
  */
 public function render(Append $append, $prefix = 'sidebar')
 {
     $this->view = $prefix . '::' . $this->view;
     if ($append->isAuthorized()) {
         return $this->factory->make($this->view, ['append' => $append])->render();
     }
 }
开发者ID:fordongu,项目名称:maigc-menubar,代码行数:12,代码来源:IlluminateAppendRenderer.php

示例13: renderer

 /**
  * Render the breadcrumbs view.
  *
  * @param $view
  * @param $breadcrumbs
  * @return string
  * @throws Exception
  */
 public function renderer($view, $breadcrumbs)
 {
     if (!is_null($view)) {
         return $this->master->make($view, compact('breadcrumbs'))->render();
     }
     throw new Exception('Breadcrumbs view not specified (check the view in config/breadcrumbs.php, and ensure DaveJamesMiller\\Breadcrumbs\\ServiceProvider is loaded before any dependants in config/app.php)');
 }
开发者ID:cskonline,项目名称:creation,代码行数:15,代码来源:View.php

示例14: handle

 /**
  * @param LoadPageViewIndexCommand $command
  * @return \Anomaly\FizlPages\Page\Contract\Page
  */
 public function handle(LoadPageViewIndexCommand $command)
 {
     $page = $command->getPage();
     $page->setView($this->factory->make($page->getIndexPath()));
     $page->raise(new PageViewIndexLoaded($page));
     return $page;
 }
开发者ID:hscale,项目名称:fizl-pages,代码行数:11,代码来源:LoadPageViewIndexCommandHandler.php

示例15: menu

 public function menu($items)
 {
     if (!is_array($items)) {
         $items = $this->config->get($items, array());
     }
     return $this->view->make('partials/menu', compact('items'));
 }
开发者ID:resand,项目名称:teachme,代码行数:7,代码来源:HtmlBuilder.php


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