Factory
Implements
Uses
- Macroable
- ManagesComponents
- ManagesEvents
- ManagesFragments
- ManagesLayouts
- ManagesLoops
- ManagesStacks
- ManagesTranslations
Properties
$shared array
Data that should be available to all templates.
$extensions array
The extension to engine bindings.
$composers array
The view composer events.
$renderCount int
The number of active rendering operations.
$renderedOnce array
The "once" block IDs that have been rendered.
Methods
__construct ( EngineResolver $engines , ViewFinderInterface $finder , Dispatcher $events ) : void
Create a new view factory instance.
Parameters
- $engines EngineResolver
- $finder ViewFinderInterface
- $events Dispatcher
file ( $path , $data , $mergeData ) : View
Get the evaluated view contents for the given view.
Parameters
- $path string
- $data Illuminate\...\Arrayable|array
- $mergeData array
make ( $view , $data , $mergeData ) : View
Get the evaluated view contents for the given view.
Parameters
- $view string
- $data Illuminate\...\Arrayable|array
- $mergeData array
first ( array $views , $data , $mergeData ) : View
Get the first view that actually exists from the given list.
Parameters
- $views array
- $data Illuminate\...\Arrayable|array
- $mergeData array
renderWhen ( $condition , $view , $data , $mergeData ) : string
Get the rendered content of the view based on a given condition.
Parameters
- $condition bool
- $view string
- $data Illuminate\...\Arrayable|array
- $mergeData array
renderUnless ( $condition , $view , $data , $mergeData ) : string
Get the rendered content of the view based on the negation of a given condition.
Parameters
- $condition bool
- $view string
- $data Illuminate\...\Arrayable|array
- $mergeData array
renderEach ( $view , $data , $iterator , $empty ) : string
Get the rendered contents of a partial from a loop.
Parameters
- $view string
- $data array
- $iterator string
- $empty string
normalizeName ( $name ) : string
Normalize a view name.
Parameters
- $name string
parseData ( $data ) : array
Parse the given data into a raw array.
Parameters
- $data mixed
viewInstance ( $view , $path , $data ) : View
Create a new view instance from the given arguments.
Parameters
- $view string
- $path string
- $data Illuminate\...\Arrayable|array
exists ( $view ) : bool
Determine if a given view exists.
Parameters
- $view string
getEngineFromPath ( $path ) : Engine
Get the appropriate view engine for the given path.
Parameters
- $path string
getExtension ( $path ) : string|null
Get the extension used by the view file.
Parameters
- $path string
share ( $key , $value ) : mixed
Add a piece of shared data to the environment.
Parameters
- $key array|string
- $value mixed|null
incrementRender ( ) : void
Increment the rendering counter.
decrementRender ( ) : void
Decrement the rendering counter.
doneRendering ( ) : bool
Check if there are no active render operations.
hasRenderedOnce ( string $id ) : bool
Determine if the given once token has been rendered.
Parameters
- $id string
markAsRenderedOnce ( string $id ) : void
Mark the given once token as having been rendered.
Parameters
- $id string
addLocation ( $location ) : void
Add a location to the array of view locations.
Parameters
- $location string
addNamespace ( $namespace , $hints ) : $this
Add a new namespace to the loader.
Parameters
- $namespace string
- $hints string|array
prependNamespace ( $namespace , $hints ) : $this
Prepend a new namespace to the loader.
Parameters
- $namespace string
- $hints string|array
replaceNamespace ( $namespace , $hints ) : $this
Replace the namespace hints for the given namespace.
Parameters
- $namespace string
- $hints string|array
addExtension ( $extension , $engine , $resolver ) : void
Register a valid view extension and its engine.
Parameters
- $extension string
- $engine string
- $resolver Closure |null
flushState ( ) : void
Flush all of the factory state like sections and stacks.
flushStateIfDoneRendering ( ) : void
Flush all of the section contents if done rendering.
getExtensions ( ) : array
Get the extension to engine bindings.
setFinder ( ViewFinderInterface $finder ) : void
Set the view finder instance.
Parameters
- $finder ViewFinderInterface
flushFinderCache ( ) : void
Flush the cache of views located by the finder.
setDispatcher ( Dispatcher $events ) : void
Set the event dispatcher instance.
Parameters
- $events Dispatcher
setContainer ( Container $container ) : void
Set the IoC container instance.
Parameters
- $container Container
shared ( $key , $default ) : mixed
Get an item from the shared data.
Parameters
- $key string
- $default mixed
getShared ( ) : array
Get all of the shared data for the environment.