ldc-cocotte/app/Providers/AppServiceProvider.php
Olivier Legat 7563bbc06d pagination bootstrap pour le BO
(le front doit spécifier son blade de pagination)
2021-04-19 16:22:24 +02:00

51 lines
1.2 KiB
PHP

<?php
namespace App\Providers;
use App\Models\Range;
use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Blade;
use Illuminate\Pagination\Paginator;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
if (config('app.env') !== 'local') {
\URL::forceScheme('https');
}
// on partage les ranges (gammes produit)
$ranges = Range::all();
View::share('ranges', $ranges);
Blade::directive('fmt_currency', function ($expression) {
return "<?php echo sprintf('%s €', number_format($expression, 2, ',', ' ')); ?>";
});
Blade::directive('fmt_sellunit', function ($expression) {
if (!empty($$expression)) {
return "<?php echo sprintf('/ %s', $expression); ?>";
}
});
//default paginator template for back Office
Paginator::useBootstrap();
}
}