Files
Virtnet.bond/app/Classes/helpers.php

50 lines
1.2 KiB
PHP

<?php
if (!function_exists('theme')) {
/**
* Get the specified configuration value.
*
* If an array is passed as the key, we will assume you want to set an array of values.
*
* @param array|string $key
* @param mixed $default
* @return mixed|\Illuminate\Config\Repository
*/
function theme($key, $default = null)
{
$current_theme = config('settings.theme', 'default');
return config("settings.theme_$current_theme" . "_$key", $default) ?? $default;
}
}
if (!function_exists('hook')) {
/**
* Dispatch an event and return the items
*
* @param string $event
* @param array $items
* @return array
*/
function hook($event)
{
return \App\Helpers\EventHelper::renderEvent($event);
}
}
if (!function_exists('storage_url')) {
/**
* Get the URL for a file stored on the public disk
*
* @param string|null $path
* @return string|null
*/
function storage_url(?string $path): ?string
{
if (!$path) {
return null;
}
return \Illuminate\Support\Facades\Storage::disk('public')->url($path);
}
}