2017-12-10 11:56:26 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Shortcut for retrieving a setting value
|
|
|
|
*/
|
|
|
|
if (!function_exists('setting')) {
|
|
|
|
function setting($key, $value = null)
|
|
|
|
{
|
2017-12-13 07:09:26 +08:00
|
|
|
$settingRepo = app('setting'); // defined in AppServiceProvider
|
|
|
|
if($value !== null) {
|
|
|
|
return $settingRepo->store($key, $value);
|
2017-12-10 11:56:26 +08:00
|
|
|
}
|
2017-12-13 07:09:26 +08:00
|
|
|
|
|
|
|
return $settingRepo->retrieve($key);
|
2017-12-10 11:56:26 +08:00
|
|
|
}
|
|
|
|
}
|
2017-12-18 06:58:53 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Wrap the asset URL in the publicBaseUrl that's been
|
|
|
|
* set
|
|
|
|
*/
|
|
|
|
if (!function_exists('public_asset')) {
|
|
|
|
function public_asset($path, $parameters = [], $secure = null)
|
|
|
|
{
|
|
|
|
$publicBaseUrl = app()->publicUrlPath();
|
2017-12-24 00:15:18 +08:00
|
|
|
if($path[0] !== '/') {
|
|
|
|
$path = '/'.$path;
|
|
|
|
}
|
|
|
|
|
2017-12-18 06:58:53 +08:00
|
|
|
$path = $publicBaseUrl . $path;
|
|
|
|
|
|
|
|
return url($path, $parameters, $secure);
|
|
|
|
}
|
|
|
|
}
|