- How do I install baks-dev/users-table in a Laravel 10+ project?
- Run `composer require baks-dev/users-table` to install the package. Then publish assets and run migrations with `php artisan baks:assets:install` followed by `php artisan migrate --path=vendor/baks-dev/users-table/migrations`. Always use `--pretend` first to validate SQL changes.
- Does this package work with Laravel’s built-in authentication system?
- Yes, the package assumes Laravel’s default `users` table for foreign key relationships (e.g., `user_id`). It integrates seamlessly with Laravel’s auth system, but you may need to extend policies or middleware for role-based attendance access.
- What Laravel versions and PHP versions are supported?
- The package requires **PHP 8.4+** and is optimized for **Laravel 10/11**. It leverages modern features like enums and attributes, so older Laravel versions (e.g., 9.x) will not work without significant refactoring.
- Can I customize the attendance validation rules (e.g., max hours per week)?
- The package provides a modular foundation, but custom validation logic (e.g., role-based overrides or geofencing) may require extending the model or creating custom policies. Check the `UserAttendance` model for hooks or override the `validate()` method in your application code.
- Will this package conflict with existing custom fields in my users table?
- Potential conflicts arise if your `users` table has custom columns (e.g., `employee_id`). The package uses `user_id` as a foreign key, so ensure your table structure aligns. Run `php artisan migrate --pretend` to preview schema changes before applying migrations.
- Does baks-dev/users-table support multi-tenancy (e.g., Laravel Sail or Breeze)?
- No, the package does not natively support multi-tenancy. You’ll need to manually adapt migrations or use tenant-aware tools like `stancl/tenancy` to scope attendance records per tenant. Foreign keys (e.g., `user_id`) must align with your tenancy strategy.
- How do I test attendance logic in my Laravel application?
- Run the package’s built-in tests with `php artisan test --group=users-table`. For integration testing, mock the `UserAttendance` model and test critical flows like punch-in/out validation. Use Laravel’s `RefreshDatabase` trait to reset migrations between tests.
- Can I integrate this with Sanctum or Passport for API-based attendance tracking?
- Yes, extend your Sanctum/Passport guards to include attendance endpoints. Use middleware like `auth:sanctum` or `auth:api` to restrict access. For complex workflows, create custom policies (e.g., `UserAttendancePolicy`) to authorize actions like `logAttendance`.
- Are there any performance concerns with large-scale attendance logs?
- The package doesn’t include built-in archiving, so high-volume logs may bloat your database. Mitigate this by implementing Laravel Queues to process reports asynchronously or use `softDeletes` to archive old records. Consider partitioning tables for very large datasets.
- What alternatives exist for Laravel attendance/time-tracking?
- Alternatives include `spatie/laravel-permission` (for role-based access), `laravel-shift` (shift scheduling), or `clockify/clockify-laravel` (third-party integrations). For GDPR compliance, evaluate `spatie/laravel-activitylog` to audit attendance changes. Choose based on your need for customization vs. plug-and-play functionality.