46 lines
855 B
PHP
46 lines
855 B
PHP
<?php
|
|
|
|
use App\Models\Setting;
|
|
|
|
if (!function_exists('getUserFullName')) {
|
|
function getUserFullName(?\App\Models\User $user = null): string
|
|
{
|
|
if (!$user) {
|
|
$user = auth()->user();
|
|
}
|
|
return $user->first_name . ' ' . $user->last_name;
|
|
}
|
|
}
|
|
|
|
if (!function_exists('getImageUrl')) {
|
|
|
|
function getImageUrl(?string $path): ?string
|
|
{
|
|
if (!$path) {
|
|
return null;
|
|
}
|
|
|
|
return \Illuminate\Support\Facades\Storage::url($path);
|
|
}
|
|
|
|
}
|
|
if (!function_exists('settings')) {
|
|
function settings(?string $code): ?string
|
|
{
|
|
if (!$code) {
|
|
return null;
|
|
}
|
|
|
|
$setting = Setting::query()
|
|
->where('code', $code)
|
|
->first();
|
|
|
|
if (!$setting) {
|
|
return null;
|
|
}
|
|
|
|
return $setting->value;
|
|
}
|
|
}
|
|
|