class Illuminate / View / View
You're browsing the documentation for an upcoming version of Laravel. The documentation and features of this release are subject to change.

View

Implements

Uses

Properties

protected

$factory Factory

The view factory instance.

Default: null
protected

$engine Engine

The engine implementation.

Default: null
protected

$view string

The name of the view.

Default: null
protected

$data array

The array of view data.

Default: null
protected

$path string

The path to the view file.

Default: null

Methods

public

__construct ( Factory $factory , Engine $engine , $view , $path , $data ) : void

Create a new view instance.

Parameters

public

fragment ( $fragment ) : string

Get the evaluated contents of a given fragment.

Parameters

  • $fragment string
public

fragments ( array $fragments ) : string

Get the evaluated contents for a given array of fragments.

Parameters

  • $fragments array
public

fragmentIf ( $boolean , $fragment ) : string

Get the evaluated contents of a given fragment if the given condition is true.

Parameters

  • $boolean bool
  • $fragment string
public

fragmentsIf ( $boolean , array $fragments ) : string

Get the evaluated contents for a given array of fragments if the given condition is true.

Parameters

  • $boolean bool
  • $fragments array
public

render ( callable $callback ) : string

Get the string contents of the view.

Parameters

  • $callback callable|null
protected

renderContents ( ) : string

Get the contents of the view instance.

protected

getContents ( ) : string

Get the evaluated contents of the view.

public

gatherData ( ) : array

Get the data bound to the view instance.

public

renderSections ( ) : array

Get the sections of the rendered view.

public

with ( $key , $value ) : $this

Add a piece of data to the view.

Parameters

  • $key string|array
  • $value mixed
public

nest ( $key , $view , array $data ) : $this

Add a view instance to the view data.

Parameters

  • $key string
  • $view string
  • $data array
public

withErrors ( $provider , $bag ) : $this

Add validation errors to the view.

Parameters

protected

formatErrors ( $provider ) : MessageBag

Parse the given errors into an appropriate value.

Parameters

public

name ( ) : string

Get the name of the view.

public

getName ( ) : string

Get the name of the view.

public

getData ( ) : array

Get the array of view data.

public

getPath ( ) : string

Get the path to the view file.

public

setPath ( $path ) : void

Set the path to the view.

Parameters

  • $path string
public

getFactory ( ) : Factory

Get the view factory instance.

public

getEngine ( ) : Engine

Get the view's rendering engine.

public

offsetExists ( $key ) : bool

Determine if a piece of data is bound.

Parameters

  • $key string
public

offsetGet ( $key ) : mixed

Get a piece of bound data to the view.

Parameters

  • $key string
public

offsetSet ( $key , $value ) : void

Set a piece of data on the view.

Parameters

  • $key string
  • $value mixed
public

offsetUnset ( $key ) : void

Unset a piece of data from the view.

Parameters

  • $key string
public

__get ( $key ) : mixed

Get a piece of data from the view.

Parameters

  • $key string
public

__set ( $key , $value ) : void

Set a piece of data on the view.

Parameters

  • $key string
  • $value mixed
public

__isset ( $key ) : bool

Check if a piece of data is bound to the view.

Parameters

  • $key string
public

__unset ( $key ) : void

Remove a piece of bound data from the view.

Parameters

  • $key string
public

__call ( $method , $parameters ) : View

Dynamically bind parameters to the view.

Parameters

  • $method string
  • $parameters array
public

toHtml ( ) : string

Get content as a string of HTML.

public

__toString ( ) : string

Get the string contents of the view.