Add helper for the skin view

This commit is contained in:
Nabeel Shahzad 2018-01-11 21:21:33 -06:00
parent 0c7117da6c
commit 4fb8a1aaf9
2 changed files with 16 additions and 2 deletions

View File

@ -15,11 +15,12 @@ class Controller extends BaseController
* Display a view but pull it from the active skin
* @param string $template
* @param array $vars
* @param array $merge_data
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function view(string $template, array $vars=[])
public function view($template, array $vars=[], $merge_data=[])
{
$tpl = 'layouts/' . config('phpvms.skin') . '/' . $template;
return view($tpl, $vars);
return view($tpl, $vars, $merge_data);
}
}

View File

@ -1,5 +1,18 @@
<?php
if (!function_exists('skin_view')) {
/**
* Render a skin
* @param $template
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
function skin_view($template, array $vars = [], $merge_data = [])
{
$tpl = 'layouts/' . config('phpvms.skin') . '/' . $template;
return view($tpl, $vars, $merge_data);
}
}
/**
* Shortcut for retrieving a setting value
*/