Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
17 / 17
AppServiceProvider
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
2 / 2
5
100.00% covered (success)
100.00%
17 / 17
 register
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 boot
100.00% covered (success)
100.00%
1 / 1
4
100.00% covered (success)
100.00%
16 / 16
<?php
namespace App\Providers;
use App\User;
use View;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use App\Models\Admin\Setting;
class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        Schema::defaultStringLength(191);
        
        View::composer('*', function($view)
        {
            $itms = DB::table('users')->where('users.id', auth()->id())
            ->Join('notifications', 'users.id', '=', 'notifications.notifiable_id')
            ->orderBy('notifications.created_at','DESC')->limit(10)->get();
            $comp_off = 'disable';
            $comp_off_approval = null;
            if (Schema::hasTable('settings')) {
                $setting = Setting::where('name','comp_off')->first();
                if(!empty($setting)){
                    $comp_off = $setting->value;
                    $approval = Setting::where('name','comp_off_approval')->first();
                    if(!empty($approval)){
                        $comp_off_approval = $approval->value;
                    }
                }
                
            }
            
            $view->with(['itms' =>  $itms,'comp_off' => $comp_off,'comp_off_approval' => $comp_off_approval ]);
        });
    }
}