Skip to content

Commit

Permalink
View 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Aldarien committed Aug 10, 2017
1 parent 16188e2 commit d302cd8
Show file tree
Hide file tree
Showing 5 changed files with 756 additions and 0 deletions.
21 changes: 21 additions & 0 deletions app/Contract/View.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
namespace App\Contract;

use App\Trait\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 changes: 5 additions & 0 deletions app/Helper/function.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php
function view($template, $variables = null) {
return App\Contract\View::show($template, $variables);
}
?>
27 changes: 27 additions & 0 deletions app/Service/View.php
Original file line number Diff line number Diff line change
@@ -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();
}
}
?>
22 changes: 22 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "aldarien/view",
"description": "View module for my apps",
"type": "library",
"require": {
"philo/laravel-blade": "^3.1",
"aldarien/contract": "^1.0",
"aldarien/config": "^1.0"
},
"license": "MIT",
"authors": [
{
"name": "Aldarien",
"email": "aldarien85@gmail.com"
}
],
"autoload": {
"psr-4": {
"App\\": "app"
}
}
}
Loading

0 comments on commit d302cd8

Please sign in to comment.