config
This commit is contained in:
30
app_old/aldarien/view/app/Contract/View.php
Normal file
30
app_old/aldarien/view/app/Contract/View.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
namespace App\Contract;
|
||||
|
||||
use App\Alias\RemoteConnection;
|
||||
use App\Definition\Contract;
|
||||
use App\Service\Money;
|
||||
use App\Service\Remote;
|
||||
use App\Service\View as ViewService;
|
||||
use GuzzleHttp\Client;
|
||||
|
||||
class View
|
||||
{
|
||||
use Contract;
|
||||
|
||||
protected static function newInstance()
|
||||
{
|
||||
$remote = new Remote(new RemoteConnection());
|
||||
$money = (new Money(new Client([
|
||||
'base_uri' => "http://{$remote->getIP()}:8008",
|
||||
'headers' => ['Accept' => 'application/json']
|
||||
])));
|
||||
return new ViewService(['money' => $money]);
|
||||
}
|
||||
public static function show($template, $variables = null)
|
||||
{
|
||||
$instance = self::getInstance();
|
||||
return $instance->show($template, $variables);
|
||||
}
|
||||
}
|
||||
?>
|
5
app_old/aldarien/view/app/Helper/functions.php
Normal file
5
app_old/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
app_old/aldarien/view/app/Service/View.php
Normal file
27
app_old/aldarien/view/app/Service/View.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
namespace App\Service;
|
||||
|
||||
use eftec\bladeone\BladeOne;
|
||||
|
||||
class View
|
||||
{
|
||||
protected $views;
|
||||
protected $cache;
|
||||
protected $blade;
|
||||
|
||||
public function __construct(array $variables = [])
|
||||
{
|
||||
$this->views = config('locations.views');
|
||||
$this->cache = config('locations.cache');
|
||||
|
||||
$this->blade = new BladeOne($this->views, $this->cache, null, $variables);
|
||||
}
|
||||
public function show($template, $vars = null)
|
||||
{
|
||||
if ($vars) {
|
||||
return $this->blade->run($template, $vars);
|
||||
}
|
||||
return $this->blade->run($template);
|
||||
}
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user