Skip to content

Commit 9f51a12

Browse files
authored
Merge pull request #48 from answeb/master
Documentation update
2 parents 3b1d0a1 + 70a6dd0 commit 9f51a12

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

README.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Install the package:
1919
composer require andreaselia/laravel-firefly
2020
```
2121

22-
Publish package files:
22+
Publish package files (config, migrations, assets and views) :
2323

2424
```bash
2525
php artisan vendor:publish --provider="Firefly\FireflyServiceProvider"
@@ -80,6 +80,40 @@ You can enable a WYSIWYG editor by adding / updating the flag in the config:
8080
This uses the Quill WYSIWYG editor library, docs can be found at: https://quilljs.com/docs.
8181
The snow theme and basic editing controls are provided out of the box in the config, but these can be modified to fit your needs.
8282

83+
### Policies
84+
85+
By default, Firefly policies are very permissive. In order to adapt the permissions model to your own application, please use
86+
your AuthServiceProvider file :
87+
88+
1. Create your policy files : `php artisan make:policy MyGroupPolicy`
89+
2. In the generated class, extend the base Firefly policy :
90+
91+
```php
92+
<?php
93+
94+
namespace App\Policies;
95+
96+
use Illuminate\Auth\Access\HandlesAuthorization;
97+
use Firefly\Policies\GroupPolicy;
98+
99+
class MyGroupPolicy extends GroupPolicy {
100+
...
101+
```
102+
103+
3. Implement whatever policy you wish (use the policies in `vendor/andreaselia/laravel-firefly/src/Policies` for reference)
104+
4. Update the policies array in `app/Providers/AuthServiceProvider.php` :
105+
106+
```php
107+
...
108+
use Firefly\Models\Group;
109+
...
110+
protected $policies = [
111+
Group::class => 'App\Policies\MyGroupPolicy',
112+
];
113+
```
114+
115+
Learn more at https://laravel.com/docs/8.x/authorization#registering-policies
116+
83117
## Contributing
84118

85119
You're more than welcome to submit a pull request, or if you're not feeling up to it - create an issue so someone else can pick it up.

src/FireflyServiceProvider.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ protected function defineAssetPublishing()
151151
$this->publishes([
152152
__DIR__.'/../public/' => public_path('vendor/firefly'),
153153
], 'firefly-assets');
154+
155+
$this->publishes([
156+
__DIR__.'/../resources/views/' => resource_path('views/vendor/firefly'),
157+
], 'firefly-views');
154158
}
155159

156160
/**

0 commit comments

Comments
 (0)