Dependencies
This commit is contained in:
21
aldarien/view/app/Contract/View.php
Normal file
21
aldarien/view/app/Contract/View.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
namespace App\Contract;
|
||||
|
||||
use App\Definition\Contract;
|
||||
use App\Service\View as ViewService;
|
||||
|
||||
class View
|
||||
{
|
||||
use Contract;
|
||||
|
||||
protected static function newInstance()
|
||||
{
|
||||
return new ViewService();
|
||||
}
|
||||
public static function show($template, $variables = null)
|
||||
{
|
||||
$instance = self::getInstance();
|
||||
return $instance->show($template, $variables);
|
||||
}
|
||||
}
|
||||
?>
|
5
aldarien/view/app/Helper/functions.php
Normal file
5
aldarien/view/app/Helper/functions.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
function view($template, $variables = null) {
|
||||
return \App\Contract\View::show($template, $variables);
|
||||
}
|
||||
?>
|
27
aldarien/view/app/Service/View.php
Normal file
27
aldarien/view/app/Service/View.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
namespace App\Service;
|
||||
|
||||
use Philo\Blade\Blade;
|
||||
|
||||
class View
|
||||
{
|
||||
protected $views;
|
||||
protected $cache;
|
||||
protected $blade;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->views = config('locations.views');
|
||||
$this->cache = config('locations.cache');
|
||||
|
||||
$this->blade = new Blade($this->views, $this->cache);
|
||||
}
|
||||
public function show($template, $vars = null)
|
||||
{
|
||||
if ($vars) {
|
||||
return $this->blade->view()->make($template, $vars)->render();
|
||||
}
|
||||
return $this->blade->view()->make($template)->render();
|
||||
}
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user