123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <?php
- namespace App\Providers;
- use Illuminate\Support\Facades\Blade;
- use Illuminate\Support\Facades\Log;
- use Illuminate\Support\ServiceProvider;
- class AppServiceProvider extends ServiceProvider
- {
-
- public function register()
- {
-
- }
-
- public function boot()
- {
-
-
- $this->registerBladeDirective();
- }
- protected function registerBladeDirective()
- {
- Blade::directive('hasAuth', function ($auth) {
- return "<?php if(auth()->user()->hasAuth({$auth})): ?>";
- });
- Blade::directive('endHasAuth', function () {
- return '<?php endif; ?>';
- });
- Blade::directive('notCustomer', function () {
- return "<?php if(!in_array(auth()->user()->role_id,[\App\Http\Models\Role::TYPE_CUSTOMER,\App\Http\Models\Role::TYPE_TYPE_CUSTOMER_STAFF])): ?>";
- });
- Blade::directive('endNotCustomer', function () {
- return '<?php endif; ?>';
- });
- }
- }
|