app/Providers/AuthServiceProvider.php
/**
     * Register any authentication / authorization services.
     *
     * @return void
     */
Register any authentication / authorization services.
@return void
Register any authentication / authorization services . @return void
public function boot()
    {
        $this->registerPolicies();
        Gate::define('dosenpembimbing', function(User $user){
            return $user->role=='dosenpembimbing';
        });
        Gate::define('pembimbingindustri', function(User $user){
            return $user->role=='pembimbingindustri';
        });
        Gate::define('mahasiswa', function(User $user){
            return $user->role=='mahasiswa';
        });
        Gate::define('hrd', function(User $user){
            return $user->role=='pembimbingindustri'&&$user->pembimbingIndustri->is_hrd==1;
        });
        Gate::define('status-laporan', function(User $user, Laporan $laporan){
            $pemagang = $laporan->pemagangan;
            if($pemagang->dosenPembimbing==auth()->user()->dosenpembimbing){
                return $laporan->approve_dosen!='pending';
            }elseif($pemagang->dosenPembimbing2==auth()->user()->dosenpembimbing){
                return $laporan->approve_dosen2!='pending';
            }else{
                return $laporan->approve_industri!='pending'&&!is_null($laporan->approve_industri_nilai);
            }
        });
    }
public function boot ( ) { $ this -> registerPolicies ( ) ; Gate :: define ( 'dosenpembimbing' , function ( User $ user ) { return $ user -> role == 'dosenpembimbing' ; } ) ; Gate :: define ( 'pembimbingindustri' , function ( User $ user ) { return $ user -> role == 'pembimbingindustri' ; } ) ; Gate :: define ( 'mahasiswa' , function ( User $ user ) { return $ user -> role == 'mahasiswa' ; } ) ; Gate :: define ( 'hrd' , function ( User $ user ) { return $ user -> role == 'pembimbingindustri' && $ user -> pembimbingIndustri -> is_hrd == 1 ; } ) ; Gate :: define ( 'status-laporan' , function ( User $ user , Laporan $ laporan ) { $ pemagang = $ laporan -> pemagangan ; if ( $ pemagang -> dosenPembimbing == auth ( ) -> user ( ) -> dosenpembimbing ) { return $ laporan -> approve_dosen != 'pending' ; } elseif ( $ pemagang -> dosenPembimbing2 == auth ( ) -> user ( ) -> dosenpembimbing ) { return $ laporan -> approve_dosen2 != 'pending' ; } else { return $ laporan -> approve_industri != 'pending' && ! is_null ( $ laporan -> approve_industri_nilai ) ; } } ) ; }
Register any authentication / authorization services.
Register any authentication / authorization services .
//