File: /var/www/ipsremont-demo/app/Providers/AppServiceProvider.php
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Blade::directive('money', static function ($amount) {
return "<?php echo number_format($amount, 2, ',', ' ') . ' ' . session()->get('currencySymbol') ?>";
});
Blade::directive('moneyShort', static function ($amount) {
return "<?php echo number_format($amount, 2, ',', ' ') . ' ' . session()->get('currencyShort') ?>";
});
Blade::directive('cartAmount', function () {
return "<?php echo App\Models\Cart::my()->count() ?>";
});
Blade::directive('formatViewDate', function ($date) {
return "<?php echo \Carbon\Carbon::parse($date)->format(config('crud.formatDate')) ?>";
});
}
}