-
Notifications
You must be signed in to change notification settings - Fork 69
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
How can I add middleware to log automatically #13
Comments
add the below middleware into your route middlewares: Shetabit\Visitor\Middlewares\LogVisits then use and use |
http://prntscr.com/ssdkhh And then what is the next step? |
you have introduced the add it on the routes that you want their logs: Route::middleware(['visitors'])->get('/', 'exampleController@method'); you have imported trait in your model, then you should use it in model like the below: class YourModel extends Model {
use Visitable;
} |
I already tried like that before https://www.dropbox.com/s/9g9fva3yxxunxf8/laravel.log?dl=0 |
[2020-06-02 14:07:28] local.ERROR: Target class [App\Http\Shetabit\Visitor\Middlewares\LogVisits] does not exist. {"exception":"[object] (Illuminate\Contracts\Container\BindingResolutionException(code: 0): Target class [App\Http\Shetabit\Visitor\Middlewares\LogVisits] does not exist. at E:\2020\5. |
in your kernel, add a back slash before middleware's path: 'visitors' => \Shetabit\Visitor\Middlewares\LogVisits::class, the error is because of that. |
same issue |
[2020-06-02 14:17:07] local.ERROR: Driver not selected or default driver does not exist. {"exception":"[object] (Shetabit\Visitor\Exceptions\DriverNotFoundException(code: 0): Driver not selected or default driver does not exist. at E:\2020\5. May\laravel-movies\vendor\shetabit\visitor\src\Visitor.php:341) |
Driver not selected or default driver does not exist. |
publish package configs: php artisan vendor:publish a config file must be exists after that: |
I already publish vendor |
have you cached configs? you need to clear cache php artisan config:clear |
Wow |
You are great. |
Your welcome. |
it will be a good idea if you added this explanation to your install and config details(the setup documentation) ,good job, thank you |
Detailed description
Hello
I am using Laravel 7.0
composer install and migration successfully done
I wanted to add middleware to log automatically.
I tried many times but failed
Can you give me a tip to solve this issue
Context
I want to track the visitors on my web admin panel
Possible implementation
middleware issue
Your environment
Include as many relevant details about the environment you experienced the bug in and how to reproduce it.
The text was updated successfully, but these errors were encountered: