master

laravel/framework

Last updated at: 29/12/2023 09:25

View.php

TLDR

This file defines a facade class View in the Illuminate\Support\Facades namespace. The class provides static methods for interacting with views in Laravel.

Methods

file

This method returns an instance of \Illuminate\Contracts\View\View for the specified view file.

make

This method returns an instance of \Illuminate\Contracts\View\View for the specified view.

first

This method returns an instance of \Illuminate\Contracts\View\View for the first view in the array that exists.

renderWhen

This method renders the specified view if the condition is true.

renderUnless

This method renders the specified view unless the condition is true.

renderEach

This method renders the specified view for each item in the data array.

exists

This method checks if the specified view exists.

getEngineFromPath

This method returns the view engine for the specified view path.

share

This method shares variables across views.

incrementRender

This method increments the render count.

decrementRender

This method decrements the render count.

doneRendering

This method checks if the rendering has been completed.

hasRenderedOnce

This method checks if the view has been rendered at least once.

markAsRenderedOnce

This method marks the view as rendered at least once.

addLocation

This method adds a location to the view finder.

addNamespace

This method adds a namespace to the view finder.

prependNamespace

This method prepends a namespace to the view finder.

replaceNamespace

This method replaces a namespace in the view finder.

addExtension

This method adds an extension to the view engine resolver.

flushState

This method flushes the view rendering state.

flushStateIfDoneRendering

This method flushes the view rendering state if the rendering is completed.

getExtensions

This method returns the registered view extensions.

getEngineResolver

This method returns the view engine resolver.

getFinder

This method returns the view finder.

setFinder

This method sets the view finder.

flushFinderCache

This method flushes the view finder cache.

getDispatcher

This method returns the event dispatcher.

setDispatcher

This method sets the event dispatcher.

getContainer

This method returns the container.

setContainer

This method sets the container.

shared

This method gets a shared view variable.

getShared

This method returns all shared view variables.

macro

This method adds a macro to the view factory.

mixin

This method adds a mixin to the view factory.

hasMacro

This method checks if a macro is defined.

flushMacros

This method flushes all macros.

startComponent

This method starts a component.

startComponentFirst

This method starts the first specified component.

renderComponent

This method renders the component.

getConsumableComponentData

This method gets the consumable data for a component.

slot

This method starts a slot.

endSlot

This method ends a slot.

creator

This method registers a view creator.

composers

This method registers multiple view composers.

composer

This method registers a view composer.

callComposer

This method calls the registered composer for a view.

callCreator

This method calls the registered creator for a view.

startFragment

This method starts a fragment.

stopFragment

This method stops a fragment and returns its contents.

getFragment

This method gets the contents of a fragment.

getFragments

This method returns all fragments.

flushFragments

This method flushes all fragments.

startSection

This method starts a section.

inject

This method injects content into a section.

yieldSection

This method yields the current section.

stopSection

This method stops the current section.

appendSection

This method appends the current section.

yieldContent

This method yields the content for a section.

parentPlaceholder

This method returns the parent placeholder for a section.

hasSection

This method checks if a section is defined.

sectionMissing

This method checks if a section is missing.

getSection

This method gets the contents of a section.

getSections

This method returns all sections.

flushSections

This method flushes all sections.

addLoop

This method adds a loop to the view.

incrementLoopIndices

This method increments the loop indices.

popLoop

This method pops the loop stack.

getLastLoop

This method returns the last loop or null if not available.

getLoopStack

This method returns the loop stack.

startPush

This method starts a push section.

stopPush

This method stops a push section and returns its contents.

startPrepend

This method starts a prepend section.

stopPrepend

This method stops a prepend section and returns its contents.

yieldPushContent

This method yields the content of a push section.

flushStacks

This method flushes all stacks.

startTranslation

This method starts a translation.

renderTranslation

This method renders the translation.

Classes

No classes are defined in this file.

<?php

namespace Illuminate\Support\Facades;

/**
 * @method static \Illuminate\Contracts\View\View file(string $path, \Illuminate\Contracts\Support\Arrayable|array $data = [], array $mergeData = [])
 * @method static \Illuminate\Contracts\View\View make(string $view, \Illuminate\Contracts\Support\Arrayable|array $data = [], array $mergeData = [])
 * @method static \Illuminate\Contracts\View\View first(array $views, \Illuminate\Contracts\Support\Arrayable|array $data = [], array $mergeData = [])
 * @method static string renderWhen(bool $condition, string $view, \Illuminate\Contracts\Support\Arrayable|array $data = [], array $mergeData = [])
 * @method static string renderUnless(bool $condition, string $view, \Illuminate\Contracts\Support\Arrayable|array $data = [], array $mergeData = [])
 * @method static string renderEach(string $view, array $data, string $iterator, string $empty = 'raw|')
 * @method static bool exists(string $view)
 * @method static \Illuminate\Contracts\View\Engine getEngineFromPath(string $path)
 * @method static mixed share(array|string $key, mixed|null $value = null)
 * @method static void incrementRender()
 * @method static void decrementRender()
 * @method static bool doneRendering()
 * @method static bool hasRenderedOnce(string $id)
 * @method static void markAsRenderedOnce(string $id)
 * @method static void addLocation(string $location)
 * @method static \Illuminate\View\Factory addNamespace(string $namespace, string|array $hints)
 * @method static \Illuminate\View\Factory prependNamespace(string $namespace, string|array $hints)
 * @method static \Illuminate\View\Factory replaceNamespace(string $namespace, string|array $hints)
 * @method static void addExtension(string $extension, string $engine, \Closure|null $resolver = null)
 * @method static void flushState()
 * @method static void flushStateIfDoneRendering()
 * @method static array getExtensions()
 * @method static \Illuminate\View\Engines\EngineResolver getEngineResolver()
 * @method static \Illuminate\View\ViewFinderInterface getFinder()
 * @method static void setFinder(\Illuminate\View\ViewFinderInterface $finder)
 * @method static void flushFinderCache()
 * @method static \Illuminate\Contracts\Events\Dispatcher getDispatcher()
 * @method static void setDispatcher(\Illuminate\Contracts\Events\Dispatcher $events)
 * @method static \Illuminate\Contracts\Container\Container getContainer()
 * @method static void setContainer(\Illuminate\Contracts\Container\Container $container)
 * @method static mixed shared(string $key, mixed $default = null)
 * @method static array getShared()
 * @method static void macro(string $name, object|callable $macro)
 * @method static void mixin(object $mixin, bool $replace = true)
 * @method static bool hasMacro(string $name)
 * @method static void flushMacros()
 * @method static void startComponent(\Illuminate\Contracts\View\View|\Illuminate\Contracts\Support\Htmlable|\Closure|string $view, array $data = [])
 * @method static void startComponentFirst(array $names, array $data = [])
 * @method static string renderComponent()
 * @method static mixed|null getConsumableComponentData(string $key, mixed $default = null)
 * @method static void slot(string $name, string|null $content = null, array $attributes = [])
 * @method static void endSlot()
 * @method static array creator(array|string $views, \Closure|string $callback)
 * @method static array composers(array $composers)
 * @method static array composer(array|string $views, \Closure|string $callback)
 * @method static void callComposer(\Illuminate\Contracts\View\View $view)
 * @method static void callCreator(\Illuminate\Contracts\View\View $view)
 * @method static void startFragment(string $fragment)
 * @method static string stopFragment()
 * @method static mixed getFragment(string $name, string|null $default = null)
 * @method static array getFragments()
 * @method static void flushFragments()
 * @method static void startSection(string $section, string|null $content = null)
 * @method static void inject(string $section, string $content)
 * @method static string yieldSection()
 * @method static string stopSection(bool $overwrite = false)
 * @method static string appendSection()
 * @method static string yieldContent(string $section, string $default = '')
 * @method static string parentPlaceholder(string $section = '')
 * @method static bool hasSection(string $name)
 * @method static bool sectionMissing(string $name)
 * @method static mixed getSection(string $name, string|null $default = null)
 * @method static array getSections()
 * @method static void flushSections()
 * @method static void addLoop(\Countable|array $data)
 * @method static void incrementLoopIndices()
 * @method static void popLoop()
 * @method static \stdClass|null getLastLoop()
 * @method static array getLoopStack()
 * @method static void startPush(string $section, string $content = '')
 * @method static string stopPush()
 * @method static void startPrepend(string $section, string $content = '')
 * @method static string stopPrepend()
 * @method static string yieldPushContent(string $section, string $default = '')
 * @method static void flushStacks()
 * @method static void startTranslation(array $replacements = [])
 * @method static string renderTranslation()
 *
 * @see \Illuminate\View\Factory
 */
class View extends Facade
{
    /**
     * Get the registered name of the component.
     *
     * @return string
     */
    protected static function getFacadeAccessor()
    {
        return 'view';
    }
}