2020-02-12 01:32:41 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
|
|
|
use Illuminate\Support\Facades\Blade;
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Keep custom directives that can be used in templates
|
|
|
|
*/
|
|
|
|
class DirectiveServiceProvider extends ServiceProvider
|
|
|
|
{
|
|
|
|
public function boot(): void
|
|
|
|
{
|
|
|
|
Blade::directive('minutestotime', function ($expr) {
|
|
|
|
return "<?php echo \App\Support\Units\Time::minutesToTimeString($expr); ?>";
|
|
|
|
});
|
|
|
|
|
|
|
|
Blade::directive('minutestohours', function ($expr) {
|
|
|
|
return "<?php echo \App\Support\Units\Time::minutesToHours($expr); ?>";
|
|
|
|
});
|
2021-01-18 04:59:32 +08:00
|
|
|
|
|
|
|
Blade::directive('secstohhmm', function ($expr) {
|
|
|
|
return "<?php echo secstohhmm($expr); ?>";
|
|
|
|
});
|
2020-02-12 01:32:41 +08:00
|
|
|
}
|
|
|
|
}
|