本文整理汇总了PHP中Illuminate\Contracts\View\Factory::make方法的典型用法代码示例。如果您正苦于以下问题:PHP Factory::make方法的具体用法?PHP Factory::make怎么用?PHP Factory::make使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Contracts\View\Factory
的用法示例。
在下文中一共展示了Factory::make方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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();
}
}
示例3: 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);
}
示例4: menu
public function menu($items)
{
if (!is_array($items)) {
$items = $this->config->get($items, array());
}
return $this->view->make('partials/menu', compact('items'));
}
示例5: 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;
}
示例6: 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)');
}
示例7: 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',
]));
*/
}
示例8: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
$this->registerClassAutoloadExceptions();
$bindings = array();
foreach ($this->getAbstracts() as $abstract) {
// Validator and seeder cause problems
if (in_array($abstract, ['validator', 'seeder'])) {
continue;
}
try {
$concrete = $this->laravel->make($abstract);
if (is_object($concrete)) {
$class = get_class($concrete);
if (strpos($class, 'Proxy_') === 0) {
$class = get_parent_class($class);
}
$bindings[$abstract] = $class;
}
} catch (\Exception $e) {
if ($this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
$this->comment("Cannot make '{$abstract}': " . $e->getMessage());
}
}
}
$content = $this->view->make('ide-helper::meta', ['bindings' => $bindings, 'methods' => $this->methods])->render();
$filename = $this->option('filename');
$written = $this->files->put($filename, $content);
if ($written !== false) {
$this->info("A new meta file was written to {$filename}");
} else {
$this->error("The meta file could not be created at {$filename}");
}
}
示例9: 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);
}
示例10: 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'));
}
示例11: handle
/**
* @param LoadPageView404Command $command
* @return Page
*/
public function handle(LoadPageView404Command $command)
{
$page = $command->getPage();
$page->setView($this->factory->make($page->getMissingPath()));
$page->setMissing(true);
$page->raise(new PageView404Loaded($page));
return $page;
}
示例12: render
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $e
*
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $e)
{
if ($e instanceof HttpException) {
if ($this->view->exists('errors.' . $e->getStatusCode())) {
return $this->view->make('errors.' . $e->getStatusCode(), ['request' => $request, 'exception' => $e]);
}
}
return parent::render($request, $e);
}
示例13: render
/**
* @param Request $request
* @param array $routeParams
* @return \Illuminate\Contracts\View\View
*/
public function render(Request $request, array $routeParams = [])
{
$token = array_get($routeParams, 'token');
$token = PasswordToken::findOrFail($token);
if ($token->created_at < new DateTime('-1 day')) {
throw new InvalidConfirmationTokenException();
}
return $this->view->make('flarum::reset')->with('token', $token->id);
}
示例14: render
/**
* @param Request $request
* @return \Illuminate\Contracts\View\View
* @throws InvalidConfirmationTokenException
*/
public function render(Request $request)
{
$token = array_get($request->getQueryParams(), 'token');
$token = PasswordToken::findOrFail($token);
if ($token->created_at < new DateTime('-1 day')) {
throw new InvalidConfirmationTokenException();
}
return $this->view->make('flarum::reset')->with('translator', $this->translator)->with('passwordToken', $token->id)->with('csrfToken', $request->getAttribute('session')->get('csrf_token'));
}
示例15: get
/**
* Returns the cached view
*
* @param string $view
* @param mixed|null $data
* @param mixed|null $prefix
* @param mixed|null $tags
*
* @return string
*/
public function get($view, $data = null, $prefix = null, $tags = null)
{
$key = $this->makeKey($view, (array) $data, (array) $prefix);
if (!$this->shouldCache) {
return $this->view->make($view, $data)->render();
}
return $this->getCache((array) $tags)->rememberForever($key, function () use($view, $data) {
return $this->view->make($view, (array) $data)->render();
});
}