public function scopeOlderThan($query, $time)
    {
        if ( ! $time instanceof Carbon)
        {
            $time = Carbon::createFromTimestamp($time);
        }

        return $query->where('created_at', '<=', $time->toDateTimeString())->latest();
    }
public function scopeOlderThan($query, $time)
    {
        if ( ! $time instanceof Carbon)
        {
            $time = Carbon::createFromTimestamp($time);
        }

        return $query->where('created_at', '<=', $time->toDateTimeString())->latest();
    }
public function scopeOlderThan ( $ query , $ time ) { if ( ! $ time instanceof Carbon ) { $ time = Carbon :: createFromTimestamp ( $ time ) ; } return $ query -> where ( 'created_at' , '<=' , $ time -> toDateTimeString ( ) ) -> latest ( ) ; }
Scope a query to only include activities older than a timestamp

@param \Illuminate\Database\Eloquent\Builder
@param Carbon|int $time
@return \Illuminate\Database\Eloquent\Builder
Scope a query to only include activities older than a timestamp