escolalms / tracker
Escola Headless LMS Tracker
Installs: 7 011
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:package
Requires
- php: >=7.4
- escolalms/auth: ^0
- escolalms/core: ^1.2.2
- laravel/framework: >=8.0
Requires (Dev)
- orchestra/testbench: ^6
- phpunit/phpunit: ^9.0
README
What does it do
The package is used to track the api route.
Tracker is enabled by default and track routes with /api/admin
prefix.
By default, /api/admin/tracks/routes
is ignored.
Installing
composer require escolalms/tracker
php artisan migrate
php artisan db:seed --class="EscolaLms\Tracker\Database\Seeders\TrackerPermissionSeeder"
Configuration
You can configure this package by specifying keys in the .env file.
TRACKER_ENABLED
- enable or disable route trackingTRACKER_ROUTE_PREFIX
- set tracked route prefixTRACKER_CONNECTION
- database connection, by defaultsqlite
You can also use facade to configure tracker.
Tracker::disable(); Http::get('api/admin/example-route') Tracker::enable(); ... Tracker::ignoreUris(['api/admin/example-route']); Http::get('api/admin/example-route') ... Tracker::prefix('api'); Http::get('api/example-route')
Database
TrackRoutes - stores tracked routes
Table track_routes
sample rows
Endpoints
Tests
Run ./vendor/bin/phpunit
to run tests. See tests folder as it's quite good staring point as documentation appendix.
Permissions
Permissions are defined in seeder
Problems
-
No permission to write to the database:
If you encounter such an error you need to check the permissions of the
database.sqlite
file on the server. If the file is not given write permissions, SQL will throw an error about not being able to write. The file should have at least 0666 permissions. -
track_routes table not found:
The error occurs because the migrations that create the tables have not been run. There is only an empty database file. You should run the
php artisan oprimize:clear
orphp artisan cache:clear
command. SqliteServiceProvider will check from the values in the cache whether migrations have been run and if the table does not exist it will create it in the database.