View
class View implements ArrayAccess (View source)
Constants
LOADER |
Nama event view loader. |
ENGINE |
Nama event view engine. |
Properties
string | $view | Berisi nama view. |
|
array | $data | Berisi data-data view. |
|
string | $path | Berisi path (absolut) view di disk. |
|
static array | $shared | Berisi data-data view yang di-share. |
|
static array | $names | Berisi list nama-nama view terdaftar. |
|
static array | $cache | Berisi list konten cache view. |
|
static string | $last | Berisi view terakhir yang akan di-render. |
|
static int | $rendered | Counter operasi render view. |
Methods
Buat instance view baru.
Periksa apakah view yang diberikan ada atau tidak.
Ambil path (absolut) view di disk.
Ambil path ke view menggunakan kovensi default.
Buat sebuah instance view baru dari sebuah named view.
Beri nama ke sebuah view.
Ambil hasil render view parsial dari sebuah loop.
Ambil string konten hasil evaluasi dari sebuah view.
Ambil konten hasil evaluasi sebuah view.
Ambil array view data untuk instance view.
Tambahkan sebuah data key-value ke view data, data ini bisa diakses di view sebagai variabel.
Tambahkan sebuah data key-value ke shared view data, Shared view data bisa diakses oleh semua view di lingkup aplikasi.
Bersihkan seluruh file hasil kompilasi blade.
Implementasi ArrayAccess::offsetExists().
Implementasi ArrayAccess::offsetGet().
Implementasi ArrayAccess::offsetSet().
Implementasi ArrayAccess::offsetUnset().
Magic Method getter.
Magic Method setter.
Magic Method untuk data checking.
Mereturn string hasil eveluasi view.
Magic Method menangani pemanggilan method secara dinamis.
Details
__construct(string $view, array $data = [])
Buat instance view baru.
// Buat sebuah instance view baru
$view = new View('home.index');
// Buat sebuah instance view baru (milik paket)
$view = new View('admin::home.index');
// Buat sebuah instance view baru dengan view data
$view = new View('home.index', ['name' => 'Budi']);
static string|bool
exists(string $view, bool $return_path = false)
Periksa apakah view yang diberikan ada atau tidak.
protected string
path(string $view)
Ambil path (absolut) view di disk.
static string
file(string $package, string $view, string $directory)
Ambil path ke view menggunakan kovensi default.
static View
make(string $view, array $data = [])
Buat sebuah instance view baru.
// Buat sebuah instance view baru
$view = View::make('home.index');
// Buat sebuah instance view baru (milik paket)
$view = View::make('admin::home.index');
// Buat sebuah instance view baru dengan view data
$view = View::make('home.index', ['name' => 'Budi']);
static View
of(string $name, array $data = [])
Buat sebuah instance view baru dari sebuah named view.
// Buat sebuah instance view baru dari sebuah named view
$view = View::of('profile');
// Buat sebuah instance view baru dari sebuah named view dengan view data
$view = View::of('profile', ['name' => 'Budi']);
static
name(string $view, string $name)
Beri nama ke sebuah view.
// Beri nama ke sebuah view
View::name('partials.profile', 'profile');
// Resolve instance ke sebuah named view
$view = View::of('profile');
static
composer(string|array $views, Closure $composer)
Daftarkan view composer menggunakan kelas \System\Event.
// Daftarkan view composer untuk view 'home.index'
View::composer('home.index', function ($view) {
$view['title'] = 'Beranda';
});
static string
render_each(string $view, array $data, string $iterator, string $empty = 'raw|')
Ambil hasil render view parsial dari sebuah loop.
string
render()
Ambil string konten hasil evaluasi dari sebuah view.
string
get()
Ambil konten hasil evaluasi sebuah view.
array
data()
Ambil array view data untuk instance view.
Shared view data akan dicampur dengan view data biasa.
View
nest(string $key, string $view, array $data = [])
Tambahkan instance view ke view data.
// Tambahkan instance view ke view data (cara 1)
$view = View::make('foo')->nest('footer', 'partials.footer');
// Tambahkan instance view ke view data (cara 2)
$view = View::make('foo')->with('footer', View::make('partials.footer'));
View
with(string $key, mixed $value = null)
Tambahkan sebuah data key-value ke view data, data ini bisa diakses di view sebagai variabel.
View
shares(string $key, mixed $value)
Chainable View::share().
static
share(string $key, mixed $value)
Tambahkan sebuah data key-value ke shared view data, Shared view data bisa diakses oleh semua view di lingkup aplikasi.
static
flush()
Bersihkan seluruh file hasil kompilasi blade.
offsetExists($offset)
Implementasi ArrayAccess::offsetExists().
offsetGet($offset)
Implementasi ArrayAccess::offsetGet().
offsetSet($offset, $value)
Implementasi ArrayAccess::offsetSet().
offsetUnset($offset)
Implementasi ArrayAccess::offsetUnset().
__get($key)
Magic Method getter.
__set($key, $value)
Magic Method setter.
__isset($key)
Magic Method untuk data checking.
string
__toString()
Mereturn string hasil eveluasi view.
$this
__call($method, array $parameters)
Magic Method menangani pemanggilan method secara dinamis.
Method ini menangai pemanggilan helper 'with_xxx'.