@@ -45,19 +45,9 @@ Abac::addPermission('read', App\Models\Post::class, [
4545
46463 . Request is allowed when actor/resource attributes satisfy the grant constraints.
4747
48- ---
49-
50- ## Documentation
51-
52- Full docs: [ https://zennit-dev.github.io/abac/ ] ( https://zennit-dev.github.io/abac/ )
53-
54- Local docs index: ` docs/index.md `
55-
56- ---
57-
5848## Artisan Commands
5949
60- The package ships with helper commands for publishing ABAC assets and scaffolding policy payloads.
50+ The package registers utility commands for consumer setup:
6151
6252``` bash
6353php artisan abac:publish
@@ -66,10 +56,48 @@ php artisan abac:publish-env
6656php artisan abac:scaffold --from-routes
6757```
6858
69- - ` abac:publish ` publishes ABAC config and environment variables in one step.
70- - ` abac:publish-config ` publishes the ` config/abac.php ` file (supports ` --force ` ).
71- - ` abac:publish-env ` writes missing ABAC environment variables to a target env-style file.
72- - ` abac:scaffold --from-routes ` generates policy stubs from ` abac.middleware.resource_patterns ` .
59+ - ` abac:publish ` runs config + env publishing in one command.
60+ - ` abac:publish-config ` publishes ` config/abac.php ` .
61+ - ` abac:publish-env ` appends missing ABAC environment variables to a chosen env file.
62+ - ` abac:scaffold --from-routes ` generates a starter policy JSON scaffold from ` abac.middleware.resource_patterns ` .
63+
64+ ## Seeding Permissions in Your App
65+
66+ Seed permissions from your consuming application's seeders instead of package-provided seeders:
67+
68+ ``` php
69+ <?php
70+
71+ namespace Database\Seeders;
72+
73+ use Illuminate\Database\Seeder;
74+ use zennit\ABAC\Facades\Abac;
75+
76+ class AbacPermissionSeeder extends Seeder
77+ {
78+ public function run(): void
79+ {
80+ Abac::addPermission('read', App\Models\Post::class, [
81+ 'role' => 'editor',
82+ 'resource.owner_id' => '123',
83+ ]);
84+
85+ Abac::addPermission('update', App\Models\Post::class, [
86+ 'actor.role' => 'admin',
87+ ]);
88+ }
89+ }
90+ ```
91+
92+ Then call your seeder from ` DatabaseSeeder ` as part of your normal app bootstrap.
93+
94+ ---
95+
96+ ## Documentation
97+
98+ Full docs: [ https://zennit-dev.github.io/abac/ ] ( https://zennit-dev.github.io/abac/ )
99+
100+ Local docs index: ` docs/index.md `
73101
74102---
75103
0 commit comments