-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
756 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} | ||
} |
Oops, something went wrong.