File
view.php
Package
Default
Class hierarchy
LaravelView
Implements

Tags

None found

Constants

loader

loader

The Laravel view loader event name.

Tags

None found

engine

engine

The Laravel view engine event name.

Tags

None found

Properties

$view

$view : string

The name of the view.

Type

string

Tags

None found

$data

$data : array

The view data.

Type

array

Tags

None found

$path

$path : string

The path to the view on disk.

Type

string

Tags

None found

$shared

$shared : array

All of the shared view data.

Type

array

Tags

None found

$names

$names : array

All of the registered view names.

Type

array

Tags

None found

$cache

$cache : array

The cache content of loaded view files.

Type

array

Tags

None found

$last

$last : string

THe last view to be rendered.

Type

string

Tags

None found

$render_count

$render_count : integer

The render operations taking place.

Type

integer

Tags

None found

Methods

__construct()

__construct(string  $view, array  $data = array()) : void

Create a new view instance.

// Create a new view instance $view = new View('home.index');

// Create a new view instance of a bundle's view
$view = new View('admin::home.index');

// Create a new view instance with bound data
$view = new View('home.index', array('name' => 'Taylor'));

Parameters

string $view
array $data

Tags

None found

exists()

exists(string  $view, boolean  $return_path = false) : string|boolean

Determine if the given view exists.

Parameters

string $view
boolean $return_path

Returns

string|boolean

static

Tags

None found

file()

file(string  $bundle, string  $view, string  $directory) : string

Get the path to a view using the default folder convention.

Parameters

string $bundle
string $view
string $directory

Returns

string

static

Tags

None found

make()

make(string  $view, array  $data = array()) : \Laravel\View

Create a new view instance.

// Create a new view instance $view = View::make('home.index');

// Create a new view instance of a bundle's view
$view = View::make('admin::home.index');

// Create a new view instance with bound data
$view = View::make('home.index', array('name' => 'Taylor'));

Parameters

string $view
array $data

Returns

LaravelView

static

Tags

None found

of()

of(string  $name, array  $data = array()) : \Laravel\View

Create a new view instance of a named view.

// Create a new named view instance $view = View::of('profile');

// Create a new named view instance with bound data
$view = View::of('profile', array('name' => 'Taylor'));

Parameters

string $name
array $data

Returns

LaravelView

static

Tags

None found

name()

name(string  $view, string  $name) : void

Assign a name to a view.

// Assign a name to a view View::name('partials.profile', 'profile');

// Resolve an instance of a named view
$view = View::of('profile');

Parameters

string $view
string $name

static

Tags

None found

composer()

composer(string|array  $views, \Closure  $composer) : void

Register a view composer with the Event class.

// Register a composer for the "home.index" view View::composer('home.index', function($view) { $view['title'] = 'Home'; });

Parameters

string|array $views
Closure $composer

static

Tags

None found

render_each()

render_each(string  $view, array  $data, string  $iterator, string  $empty = 'raw|') : string

Get the rendered contents of a partial from a loop.

Parameters

string $view
array $data
string $iterator
string $empty

Returns

string

static

Tags

None found

render()

render() : string

Get the evaluated string content of the view.

Returns

string

Tags

None found

get()

get() : string

Get the evaluated contents of the view.

Returns

string

Tags

None found

data()

data() : array

Get the array of view data for the view instance.

The shared view data will be combined with the view data.

Returns

array

Tags

None found

nest()

nest(string  $key, string  $view, array  $data = array()) : \Laravel\View

Add a view instance to the view data.

// Add a view instance to a view's data $view = View::make('foo')->nest('footer', 'partials.footer');

// Equivalent functionality using the "with" method
$view = View::make('foo')->with('footer', View::make('partials.footer'));

Parameters

string $key
string $view
array $data

Returns

LaravelView

Tags

None found

with()

with(string  $key, mixed  $value = null) : \Laravel\View

Add a key / value pair to the view data.

Bound data will be available to the view as variables.

Parameters

string $key
mixed $value

Returns

LaravelView

Tags

None found

shares()

shares(string  $key, mixed  $value) : \Laravel\View

Add a key / value pair to the shared view data.

Shared view data is accessible to every view created by the application.

Parameters

string $key
mixed $value

Returns

LaravelView

Tags

None found

share()

share(string  $key, mixed  $value) : void

Add a key / value pair to the shared view data.

Shared view data is accessible to every view created by the application.

Parameters

string $key
mixed $value

static

Tags

None found

offsetExists()

offsetExists(  $offset) 

Implementation of the ArrayAccess offsetExists method.

Parameters

$offset

Tags

None found

offsetGet()

offsetGet(  $offset) 

Implementation of the ArrayAccess offsetGet method.

Parameters

$offset

Tags

None found

offsetSet()

offsetSet(  $offset,   $value) 

Implementation of the ArrayAccess offsetSet method.

Parameters

$offset
$value

Tags

None found

offsetUnset()

offsetUnset(  $offset) 

Implementation of the ArrayAccess offsetUnset method.

Parameters

$offset

Tags

None found

__get()

__get(  $key) 

Magic Method for handling dynamic data access.

Parameters

$key

Tags

None found

__set()

__set(  $key,   $value) 

Magic Method for handling the dynamic setting of data.

Parameters

$key
$value

Tags

None found

__isset()

__isset(  $key) 

Magic Method for checking dynamically-set data.

Parameters

$key

Tags

None found

__toString()

__toString() : string

Get the evaluated string content of the view.

Returns

string

Tags

None found

__call()

__call(  $method,   $parameters) 

Magic Method for handling dynamic functions.

This method handles calls to dynamic with helpers.

Parameters

$method
$parameters

Tags

None found

path()

path(string  $view) : string

Get the path to a given view on disk.

Parameters

string $view

Returns

string

Tags

None found

load()

load() : string

Get the contents of the view file from disk.

Returns

string

Tags

None found