-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Lukas Frey <[email protected]>
- Loading branch information
1 parent
326d234
commit b531e79
Showing
2 changed files
with
122 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Guava s.r.o. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,102 @@ | ||
|
||
# Filament Drafts | ||
|
||
[![Latest Version on Packagist](https://img.shields.io/packagist/v/guava/filament-drafts.svg?style=flat-square)](https://packagist.org/packages/guava/filament-drafts) | ||
![Packagist PHP Version](https://img.shields.io/packagist/dependency-v/guava/filament-drafts/php?style=flat-square) | ||
[![Total Downloads](https://img.shields.io/packagist/dt/guava/filament-drafts.svg?style=flat-square)](https://packagist.org/packages/guava/filament-drafts) | ||
|
||
This plugin adds the ability to manage your model's drafts and revisions in your filament resources. | ||
|
||
It's a filament implementation for [Laravel Drafts](https://github.com/oddvalue/laravel-drafts). | ||
|
||
## Installation | ||
|
||
You can install the package with composer: | ||
|
||
```bash | ||
composer require guava/filament-drafts | ||
``` | ||
|
||
## Usage | ||
|
||
### Model Trait | ||
First make sure that you have correctly set-up a model to use drafts from Laravel Drafts. | ||
|
||
At the very least you need to add a trait to your model: | ||
```php | ||
use Oddvalue\Drafts\HasDrafts; | ||
|
||
class Post extends Model | ||
{ | ||
use HasDrafts; | ||
} | ||
``` | ||
|
||
After that, you need to add a few traits to your resource and resource pages: | ||
|
||
### Resource Trait | ||
Add the `Draftable` trait to your Resource: | ||
|
||
```php | ||
use Guava\FilamentDrafts\Admin\Resources\Concerns\Draftable; | ||
|
||
class PostResource extends Resource | ||
{ | ||
use Draftable; | ||
} | ||
``` | ||
|
||
### Resource Pages | ||
Add the respective `Draftable` trait to your Resource Pages: | ||
(Keep in mind that each page uses a different trait from another namespace) | ||
|
||
#### Create Page | ||
```php | ||
use Guava\FilamentDrafts\Admin\Resources\Pages\Create\Draftable; | ||
|
||
class PostResource extends Resource | ||
{ | ||
use Draftable; | ||
} | ||
``` | ||
|
||
#### Edit Page | ||
```php | ||
use Guava\FilamentDrafts\Admin\Resources\Pages\Edit\Draftable; | ||
|
||
class PostResource extends Resource | ||
{ | ||
use Draftable; | ||
} | ||
``` | ||
|
||
#### List Page | ||
```php | ||
use Guava\FilamentDrafts\Admin\Resources\Pages\List\Draftable; | ||
|
||
class PostResource extends Resource | ||
{ | ||
use Draftable; | ||
} | ||
``` | ||
|
||
## Changelog | ||
|
||
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. | ||
|
||
## Contributing | ||
|
||
Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details. | ||
|
||
## Security Vulnerabilities | ||
|
||
Please review [our security policy](../../security/policy) on how to report security vulnerabilities. | ||
|
||
## Credits | ||
|
||
- [Guava](https://github.com/GuavaCZ) | ||
- [All Contributors](../../contributors) | ||
|
||
## License | ||
|
||
The MIT License (MIT). Please see [License File](LICENSE.md) for more information. |