- How do I install and set up Laravel User Manager in my Laravel 8+ project?
- Run `composer require com.panda180.laravel/user-manager` in your project root. No additional configuration is needed—just instantiate `UserManager` and call `getUsers()` to fetch records. The package works out-of-the-box with Laravel’s Eloquent ORM.
- Does this package support Laravel 10 or PHP 8.1+? The description only mentions Laravel 8+ and PHP 7.4+.
- The package explicitly supports Laravel 8+ and PHP 7.4+, but there’s no confirmation of Laravel 10 or PHP 8.x compatibility. Test thoroughly in your environment, or check the GitHub repo for updates. If unsupported, consider forking or extending the package.
- Can I fetch users with pagination or custom query scopes (e.g., active users only)?
- The current documentation doesn’t mention pagination or scopes. The `getUsers()` method likely returns all records by default. For custom queries, you may need to extend the `UserManager` class or use Eloquent’s built-in methods like `where()` or `paginate()` separately.
- Is there a way to integrate this with Laravel’s authorization policies or gates?
- The package focuses solely on fetching users and doesn’t include built-in authorization logic. You’ll need to manually apply Laravel’s policy system or gates after retrieving users. For example, use `Gate::forUser()` or `authorize()` on the fetched user objects.
- Will this package work with non-standard user table names or custom Eloquent models?
- The package assumes a standard `users` table and Eloquent `User` model. For custom tables or models, you’ll need to override the underlying query or configure the package to use your model class. Check the source code for dependency injection points.
- Are there unit tests or examples to verify edge cases (e.g., empty results, null fields)?
- The GitHub repository lacks visible tests or examples in the provided README. Without tests, edge cases like empty datasets or malformed data may require manual handling. Consider writing integration tests for critical paths.
- Does this package support eager loading relationships (e.g., roles, permissions) when fetching users?
- No, the package doesn’t mention eager loading. If your users have relationships (e.g., `roles`), you’ll need to manually add `with()` to the query or extend the `UserManager` class to support it. Example: `$users = User::with('roles')->get();`
- How can I cache or optimize performance for large user datasets?
- The package doesn’t include caching or performance optimizations. For large datasets, implement Laravel’s cache (e.g., `Cache::remember()`) or database indexing. Alternatively, use Eloquent’s `cursor()` for lazy loading or chunking.
- Are there alternatives to this package for more advanced user management in Laravel?
- For broader user management (CRUD, validation, auth), consider `spatie/laravel-permission`, `laravel/breeze`, or `laravel/fortify`. If you only need fetching, this package is lightweight, but lacks features like soft deletes or activity logs.
- How do I handle sensitive user data (e.g., emails, passwords) when fetching users?
- The package doesn’t filter sensitive fields by default. Explicitly exclude them using Eloquent’s `select()` or create a custom query. For passwords, use Laravel’s `Hash` facade to verify or mask values. Example: `$users->makeHidden(['password', 'remember_token']);`