roundly-consulting/permissions-for-laravel
A Laravel package for adding role and permission management to your application. Define roles, assign permissions, and control access through simple, familiar APIs. Lightweight and easy to integrate, it helps keep authorization logic clear and maintainable in existing Laravel projects.
composer require <vendor>/<package> (replace with actual package name).php artisan vendor:publish --tag=<package>-config (or check the package README for the exact tag).config/<package>.php and register the models you want factories to build. The key mapping is usually 'models' => [ ... ] or similar.Package::swapModel('user', CustomUser::class)) and create another instance—it should now build CustomUser instead of the default.Where to look first: the package’s config file, its service provider (to see how model resolution is bound), and any Factory base class or trait it ships. The 1.0.2 fix means that after a host swap, factories build the configured model, so test that path early.
setUp() or a test helper to replace a model with a fake or extended version. Factories will then build the swapped model (fixed in 1.0.2), keeping test data consistent with the swapped class.new User or User::factory() directly if you rely on the package’s model configuration.Factory base class or a HasFactory trait. Override modelClass() or equivalent to return the configured model key, and use the package’s resolver rather than resolve(Model::class).^1.0.2 and add a regression test that swaps a model and asserts the factory returns the swapped class.config/<package>.php, run php artisan config:clear (and config:cache in production). Stale config can make factories build the wrong model.factory()->create(). If you swap after a factory has already been resolved, the factory may hold a stale model reference.create() or fill attributes; ensure the swapped model supports the same mass‑assignment rules and relationships.Package::getModels() or the config repository) and check whether the swap was applied. Also verify that the factory is using the package’s resolver and not Laravel’s default Factory::guessModelNamesUsing.tearDown() (or use the package’s flushSwaps() if available) to avoid leaking state between tests.How can I help you explore Laravel packages today?