Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

Laravel 4.2 - static Clear() fix when timestamps isn't used #2

Open
ghost opened this issue Jun 26, 2014 · 5 comments
Open

Laravel 4.2 - static Clear() fix when timestamps isn't used #2

ghost opened this issue Jun 26, 2014 · 5 comments
Assignees
Labels

Comments

@ghost
Copy link

ghost commented Jun 26, 2014

Please update for Laravel 4.2 (change requirements on your composer.json), and correct Jones\VisitorLog\Visitor::clear(), as Laravel 4.2 don't use timestamps, change clear()by this :

public static function clear()
    {
        $instance = new static;
        $time = Config::get('visitor-log::onlinetime');

        return $instance->newQuery()->where('updated_at', '<', date('Y-m-d H:i:s', strtotime('-'.$time.' minutes')))->delete();
    }
@JN-Jones
Copy link
Owner

The clear function hasn't worked with any Laravel version (see the readme). That's why it's still a beta version.

About composer.json: I've updated it some time ago and it works on my localhost without problems. I didn't have much time lately to work with laravel so I'm not up to date with the recent changes ;)

@JN-Jones JN-Jones added the bug label Jun 26, 2014
@JN-Jones JN-Jones self-assigned this Jun 26, 2014
@ghost
Copy link
Author

ghost commented Jun 26, 2014

At now, it's working on my Laravel 4.2, but only if the updated_at is a date, I'm working to make it work even if the updated_at is a timestamp.

@JN-Jones
Copy link
Owner

I'd make it a setting :P Not sure whether it's that easy to query the database to check whether it's a date or not. Haven't looked whether Eloquent allows to check this too.

Can you create a Pull Request when you've found a fix?

@ghost
Copy link
Author

ghost commented Jun 26, 2014

For sure.

@ghost ghost mentioned this issue Aug 4, 2014
@ghost
Copy link
Author

ghost commented Aug 4, 2014

Added the Pull Request as promised.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant