41 lines
1.2 KiB
PHP
41 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
use Illuminate\Support\Facades\Blade;
|
|
use App\Helpers\NumberHelper;
|
|
use App\Helpers\CalendarHelper;
|
|
use App\Helpers\CurrencyHelper;
|
|
|
|
class BladeServiceProvider extends ServiceProvider
|
|
{
|
|
public function register(): void
|
|
{
|
|
//
|
|
}
|
|
|
|
public function boot(): void
|
|
{
|
|
Blade::directive('localizeNumber', function ($expression) {
|
|
return "<?php echo \\App\\Helpers\\NumberHelper::formatNumber($expression); ?>";
|
|
});
|
|
|
|
Blade::directive('localizeDate', function ($expression) {
|
|
return "<?php echo \\App\\Helpers\\CalendarHelper::formatDate($expression); ?>";
|
|
});
|
|
|
|
Blade::directive('localizeCurrency', function ($expression) {
|
|
return "<?php echo \\App\\Helpers\\CurrencyHelper::formatWithSymbol($expression); ?>";
|
|
});
|
|
|
|
Blade::directive('direction', function () {
|
|
return "<?php echo in_array(app()->getLocale(), config('Vernova.rtl_locales')) ? 'rtl' : 'ltr'; ?>";
|
|
});
|
|
|
|
Blade::if('isRtl', function () {
|
|
return in_array(app()->getLocale(), config('Vernova.rtl_locales'));
|
|
});
|
|
}
|
|
}
|