-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from kenepa/release_ready
Release ready
- Loading branch information
Showing
14 changed files
with
290 additions
and
16 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 |
---|---|---|
|
@@ -39,9 +39,9 @@ the [EditRecord](https://filamentphp.com/docs/2.x/admin/resources/editing-record | |
a [simple modal resource.](https://filamentphp.com/docs/2.x/admin/resources/getting-started#simple-modal-resources) | ||
Follow the steps below to add locks to your resources. | ||
|
||
### Add Locks to your modal | ||
### Add Locks to your model | ||
|
||
The first step is to add the HasLocks trait to the modal of your resource. The HasLocks trait enables the locking | ||
The first step is to add the HasLocks trait to the model of your resource. The HasLocks trait enables the locking | ||
functionality on your model. | ||
|
||
```php | ||
|
@@ -95,13 +95,21 @@ class ListExamples extends ManageRecords | |
And that's it! Your resource is now able to be locked. Refer to the documentation below for more information on how to | ||
configure the locking functionality. | ||
|
||
## Resource Lock manager | ||
|
||
<img style="width: 100%; max-width: 100%;" alt="filament-shield-art" src="https://raw.githubusercontent.com/kenepa/Kenepa/main/art/ResourceLock/filament-resource-lock-manager.png" > | ||
|
||
The package also provides a simple way to manage and view all your active and expired locks within your app. And it also | ||
provides a way to quickly unlock all resources or specific locks. | ||
|
||
## Configuration | ||
|
||
### Access | ||
|
||
<img style="width: 100%; max-width: 100%;" alt="filament-shield-art" src="https://raw.githubusercontent.com/kenepa/Kenepa/main/art/ResourceLock/filament-locked.png" > | ||
|
||
You can restrict the access to the **Unlock** button by adjusting the access variable. Enabling the "limited" key and | ||
You can restrict the access to the **Unlock** button or to the resource manager by adjusting the access variable. | ||
Enabling the "limited" key and | ||
setting it to true allows you to specify either a Laravel Gate class or a permission name from | ||
the [Spatie Permissions package](https://github.com/spatie/laravel-permission). | ||
|
||
|
@@ -119,11 +127,24 @@ the [Spatie Permissions package](https://github.com/spatie/laravel-permission). | |
*/ | ||
|
||
'unlocker' => [ | ||
'limited_access' => false, | ||
'limited_access' => true, | ||
'gate' => 'unlock-resource' | ||
], | ||
``` | ||
|
||
Example | ||
|
||
```php | ||
|
||
// Example using gates | ||
Gate::define('unlock-resource', function (User $user, Post $post) { | ||
return $user->email === '[email protected]'; | ||
}); | ||
|
||
// Example using spatie permission package | ||
Permission::create(['name' => 'unlock-resource']); | ||
``` | ||
|
||
### Using custom models | ||
|
||
Sometimes, you may have a customized implementation for the User model in your application, or you may want to use a | ||
|
@@ -199,6 +220,12 @@ Optionally, you can publish the views using | |
php artisan vendor:publish --tag="resource-lock-views" | ||
``` | ||
|
||
## Coming soon | ||
|
||
- Locked status indicator for table rows | ||
- Polling | ||
- Displaying which users has locked a resource | ||
|
||
## Changelog | ||
|
||
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. | ||
|
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
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
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,10 @@ | ||
<?php | ||
|
||
return [ | ||
'active' => 'Aktiv', | ||
'expired' => 'Abgelaufen', | ||
'unlock' => 'Entsperren', | ||
'unlocked' => 'Entsperrter Ressourcen', | ||
'unlocked_selected' => 'Ausgewählte Ressourcen entsperrt', | ||
'unlock_all' => 'Alle Ressourcen entsperren' | ||
]; |
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,10 @@ | ||
<?php | ||
|
||
return [ | ||
'active' => 'Active', | ||
'expired' => 'Expired', | ||
'unlock' => 'Unlock', | ||
'unlocked' => 'Unlocked resource', | ||
'unlocked_selected' => 'Unlocked selected resources', | ||
'unlock_all' => 'Unlock all resources' | ||
]; |
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,10 @@ | ||
<?php | ||
|
||
return [ | ||
'active' => 'Activo', | ||
'expired' => 'Expirado', | ||
'unlock' => 'Desbloquear', | ||
'unlocked' => 'Recurso desbloqueado', | ||
'unlocked_selected' => 'Recursos seleccionados desbloqueados', | ||
'unlock_all' => 'Desbloquear todos los recursos' | ||
]; |
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,10 @@ | ||
<?php | ||
|
||
return [ | ||
'active' => 'Actif', | ||
'expired' => 'Expiré', | ||
'unlock' => 'Déverrouiller', | ||
'unlocked' => 'Ressource déverrouillée', | ||
'unlocked_selected' => 'Ressources sélectionnées déverrouillées', | ||
'unlock_all' => 'Déverrouiller toutes les ressources' | ||
]; |
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,10 @@ | ||
<?php | ||
|
||
return [ | ||
'active' => 'Actief', | ||
'expired' => 'Verlopen', | ||
'unlock' => 'Ontgrendelen', | ||
'unlocked' => 'Ontgrendelde resource', | ||
'unlocked_selected' => 'Geselecteerde resource ontgrendeld', | ||
'unlock_all' => 'Alle resources ontgrendelen' | ||
]; |
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
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
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
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
Oops, something went wrong.