src/Models/Appointment.php
public function scopeUnarchived($query)
    {
        $carbon = Carbon::parse('today midnight')->timezone('UTC');

        return $query
            ->where(function ($query) use ($carbon) {

                $query->whereIn('status', [Self::STATUS_RESERVED, Self::STATUS_CONFIRMED])
                    ->where('start_at', '<=', $carbon)
                    ->orWhere(function ($query) use ($carbon) {
                        $query->where('start_at', '>=', $carbon);
                    });
            });
    }
public function scopeUnarchived($query)
    {
        $carbon = Carbon::parse('today midnight')->timezone('UTC');

        return $query
            ->where(function ($query) use ($carbon) {

                $query->whereIn('status', [Self::STATUS_RESERVED, Self::STATUS_CONFIRMED])
                    ->where('start_at', '<=', $carbon)
                    ->orWhere(function ($query) use ($carbon) {
                        $query->where('start_at', '>=', $carbon);
                    });
            });
    }
public function scopeUnarchived ( $ query ) { $ carbon = Carbon :: parse ( 'today midnight' ) -> timezone ( 'UTC' ) ; return $ query -> where ( function ( $ query ) use ( $ carbon ) { $ query -> whereIn ( 'status' , [ Self :: STATUS_RESERVED , Self :: STATUS_CONFIRMED ] ) -> where ( 'start_at' , '<=' , $ carbon ) -> orWhere ( function ( $ query ) use ( $ carbon ) { $ query -> where ( 'start_at' , '>=' , $ carbon ) ; } ) ; } ) ; }
Scope to Unarchived Appointments.

@param Illuminate\Database\Query $query

@return Illuminate\Database\Query
Scope to Unarchived Appointments .