Download the PHP package kenepa/resource-lock without Composer

On this page you can find all versions of the php package kenepa/resource-lock. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package resource-lock

Resoure Lock

filament-resource-lock-art

Latest Version on Packagist Total Downloads

Filament Resource Lock is a Filament plugin that adds resource locking functionality to your site. When a user begins editing a resource, Filament Resource Lock automatically locks the resource to prevent other users from editing it at the same time. The resource will be automatically unlocked after a set period of time, or when the user saves or discards their changes.

filament-resource-lock-art

Installation

Plugin Version Filament Version PHP Version
1.x 2.x > 8.0
2.x 3.x > 8.1

Notice - Upgrading to Version 2.1.x :
In case you have published the config, make sure to update the following in your config:

You can install the package via composer:

Then run the installation command to publish and run migration(s)

Register plugin with a panel

You can publish run the config (optional)

Usage

The Filament Resource Lock package enables you to lock a resource and prevent other users from editing it at the same time. Currently, this package only locks the EditRecord page and the edit modal when editing a simple modal resource. Follow the steps below to add locks to your resources.

Add Locks to your model

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.

Add Locks to your EditRecord Page

The second step is to add the UsesResourceLock trait to your EditRecord page. The UsesResourceLock trait enables the locking function on your edit page.

Simple modal Resource

If your resource is a simple modal resource, you'll need to use the UsesSimpleResourceLock trait instead.

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

filament-resource-lock-art

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

filament-resource-lock-art

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.

Example

Using custom models

Sometimes, you may have a customized implementation for the User model in your application, or you may want to use a custom class for the ResourceLock functionality. In such cases, you can update the configuration file to specify the new class you want to use. This will ensure that the ResourceLock functionality works as expected with the new implementation.

Displaying the user who has locked the resource

Use the within the config to control whether or not the locked resource owner is displayed in the modal. Set the option to true to show the owner's username or other identifying information. The modal can be triggered by a button click or automatically when the resource is accessed.

By default, the package displays the name of the user: . However, if your user model doesn't have a name or you want to display a different identifier, you can create a custom action to overwrite the default behavior.

This package uses actions which allows you to implement your own custom logic. An action class is nothing more than a simple class with a method that executes some logic. Learn more about actions

To create a custom action, first create a file within your project and name it , for example. In this file, create a new class that extends the class and override the execute method to return the desired identifier. For example:

Next, register your custom action within the resource-lock.config file. Replace the default get_resource_lock_owner_action value with your custom action's class name. For example:

Overriding default functionality

If you need some custom functionality beyond what the traits provide, you can override the functions that they use. For example, if you want to change the URL that the "Return" button redirects to, you can override the resourceLockReturnUrl() function. By default, this button takes you to the index page of the resource, but you can change it to whatever URL you want by adding your custom implementation in the resourceLockReturnUrl() function.

For instance, if you want the "Return" button to redirect to https://laracasts.com, you can override the function as follows:

Now the return url will redirect to laracasts.com

This will change the behavior of the "Return" button to redirect to the provided URL.

Publishing migrations, configuration and view

You can publish and run the migrations with:

You can publish the config file with:

Optionally, you can publish the views using

Note: Publishing Blade views can introduce breaking changes into your app. If you're interested in how to stay safe, see this article by Dan Harrin.

T

Coming soon

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

License

The MIT License (MIT). Please see License File for more information.


All versions of resource-lock with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
filament/filament Version ^3.0
spatie/laravel-package-tools Version ^1.15.0
illuminate/contracts Version ^9.0|^10.0|^11.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package kenepa/resource-lock contains the following files

Loading the files please wait ....