Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Column 'visitor' cannot be null #88

Closed
mohamedshuaau opened this issue Jul 29, 2018 · 10 comments
Closed

Column 'visitor' cannot be null #88

mohamedshuaau opened this issue Jul 29, 2018 · 10 comments

Comments

@mohamedshuaau
Copy link

This happens when I clear my Cache and Cookies from the browser and refresh the browser.
I get the error Integrity Violation Column 'visitor' cannot be null.
But if I refresh again, It works.

Could it be that the cookie is not being initiated? How can I fix this?

@cyrildewit
Copy link
Owner

cyrildewit commented Jul 31, 2018

I'm not able to reproduce this. I cleared my cache using php artisan cache:clear and resetted my browser data in chrome using: at Application tab under Clear storage -> clear site data.

Did you do something different?

@mohamedshuaau
Copy link
Author

Sorry yes. I had a custom func written because my live server was running on a load balancer and fideloper proxy was not working for some reason. Basically it overrides the $request->ip() function. That is why when I am on my local development, it returns null. Sorry about that. You can close the issue.

One thing that i did not get was, how do I add unique views? And how do i get popular posts where unique id?

@cyrildewit
Copy link
Owner

One thing that i did not get was, how do I add unique views? And how do i get popular posts where unique id?

Every time when the $model->addView() method is triggered, it stores a view in the database. This view contains the viewer's unique id or his ip address if he's in igcognito mode. You can call the getUniqueViews method to get the total number of unique views.

@mohamedshuaau
Copy link
Author

Yes that is fine. But how can I use orderByViewsCount() with unique views?

@cyrildewit
Copy link
Owner

Ahh, I misunderstood. It's currently not possible. Lol, I never thought of that. I'm working on it. There will be a new release soon.

@mohamedshuaau
Copy link
Author

Well. Guess that solves this issue. When is the estimated release?

@cyrildewit
Copy link
Owner

I hope this evening.

@mohamedshuaau
Copy link
Author

Not sure what time that would be for me but I will surely keep hitting that reload button for the new update. By the way, awesome package. Just this feature was what I needed. Keep up the awesome work :)

@cyrildewit
Copy link
Owner

Thank you for the kind words.

I'm not going to make it today. I'm also not really experienced with sql, so it's going to take a while before I found the right query that I can use. I'm busy this week, but I'll try to make it as fast as possible.

@cyrildewit
Copy link
Owner

See #85

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

No branches or pull requests

2 participants