shetabit/visitor

Except is not working correctly

danielreales7 opened this issue · 12 comments

I have in except: 'except' => ['login','register','admin'] but it's not working correctly.

image

Sometimes works well and sometimes it doesn't.

Routes web:

image

And I have another file with admin routes:

image

What I can be doing wrong?

I think it's because of redirection.

please check the below file (middleware)

https://github.com/shetabit/visitor/blob/master/src/Middlewares/LogVisits.php

I think so... but I can't modify this file. I published the file but I have this error:

image

How can I fix the redirect? Thank you so much!

remove LogVisits middleware from your middlewares. create a new middleware and use it instead.

remove LogVisits middleware from your middlewares. create a new middleware and use it instead.

I still don't understand why the url /admin stores me in the database.

image

Although I have commented the middleware it keeps registering events for me.

remove LogVisits middleware from your middlewares. create a new middleware and use it instead.

Only save data when route is /admin ... is so strange. If I reload any other route within admin it doesn't save anything.

image

remove LogVisits middleware from your middlewares. create a new middleware and use it instead.

I still don't understand why the url /admin stores me in the database.

image

Although I have commented the middleware it keeps registering events for me.

this action is impossible. have you cached your routes?

you can see middleware in the below link

https://github.com/shetabit/visitor/blob/master/src/Middlewares/LogVisits.php

and we don't have any auto-registering middleware in our provider. I think this is because of Laravel's route cache.

the provider is in the below path

https://github.com/shetabit/visitor/blob/master/src/Provider/VisitorServiceProvider.php

you can see middleware in the below link

https://github.com/shetabit/visitor/blob/master/src/Middlewares/LogVisits.php

and we don't have any auto-registering middleware in our provider. I think this is because of Laravel's route cache.

the provider is in the below path

https://github.com/shetabit/visitor/blob/master/src/Provider/VisitorServiceProvider.php

Ohhhh! I understand what is happening. In the /admin route I show the unique visits:

{{ visitor()->visit()->distinct('ip')->count('ip') }}

This shouldn't create a registry for me, right? I only want to show the unique visits.

Sorry for being so heavy.

you can see middleware in the below link

https://github.com/shetabit/visitor/blob/master/src/Middlewares/LogVisits.php

and we don't have any auto-registering middleware in our provider. I think this is because of Laravel's route cache.

the provider is in the below path

https://github.com/shetabit/visitor/blob/master/src/Provider/VisitorServiceProvider.php

It's works correctly:

image

I think this should be the ideal operation because I would not like to log a visit to count unique visits.

Thank you so much for your help!

I think its better to use $this->request->is($yourPattern)

https://laravel.com/docs/8.x/requests#inspecting-the-request-path

I think its better to use $this->request->is($yourPattern)

https://laravel.com/docs/8.x/requests#inspecting-the-request-path

You're right, it was by following the configuration logic.