43 lines
759 B
PHP
43 lines
759 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Core\Facades;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* NovaCore View Facade
|
||
|
|
* Static access to view services
|
||
|
|
*/
|
||
|
|
class View
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Get view instance
|
||
|
|
*/
|
||
|
|
public static function instance(): \App\Core\View
|
||
|
|
{
|
||
|
|
return app('view');
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Render a view
|
||
|
|
*/
|
||
|
|
public static function render(string $view, array $data = []): string
|
||
|
|
{
|
||
|
|
return self::instance()->render($view, $data);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Check if view exists
|
||
|
|
*/
|
||
|
|
public static function exists(string $view): bool
|
||
|
|
{
|
||
|
|
return self::instance()->exists($view);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Share data with all views
|
||
|
|
*/
|
||
|
|
public static function share(string $key, $value): void
|
||
|
|
{
|
||
|
|
self::instance()->share($key, $value);
|
||
|
|
}
|
||
|
|
}
|