app/helpers.php
// You just create a file listing all the global methods you need, without any class// Just in case, you may check if that function already exists somewhere else if (! function_exists('frontendDate')) { function frontendDate(): String { return app(\App\Repositories\Format\GetDateFormat::class)->getFrontendDate(); }} if (! function_exists('isDemo')) { function isDemo(): String { return app()->environment() == "demo" ? 1 : 0; }} if (! function_exists('formatMoney')) { function formatMoney($amount, $useCode = false): String { return app(\App\Repositories\Money\MoneyConverter::class, ['money' => $amount])->format($useCode); }}