Download the PHP package hyperlink/laravel-model-locking without Composer

On this page you can find all versions of the php package hyperlink/laravel-model-locking. 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 laravel-model-locking

Laravel Model Locking by HYPERLINK GROUP

Installation

You can install the package via composer:

You can publish the config file with:

You can publish the translation files with:

You can publish the vue-components via:

Usage

Setting up your models

Within a model just use the IsLockable-Trait.

Additionally you have to extend the database-tables for the Model.

simple Model-Locking

If you want just a simple version of the locking, just use the Traits methods within your controller. HEARTBEAT_LOCK_DURATION should be set to something like 15 minutes (900 seconds).

To make sure no locks are missed you should use the locking:release Artisan command in your scheduler. Additionally, you should publish the config and set the lock duration to around 15 minutes.

Model-Locking by heartbeat (Vue)

The more advanced approach is to handle the locks via a heartbeat. This only works for Vue and axios.

  1. Publish the vue-components
  2. register the global HeartbeatManager

  3. register the Listener-Components

    1. for index-pages

    Handle the wished behavior like showing the current locker by the lock event and delete this information on the unlock-event.

  4. register the LockRefresher on your Edit-form.

    The lost-Event shows if the component tries to render if the model is locked by another user than the logged in.

Environment variables

Variable Default Description
HEARTBEAT_LOCK_DURATION 70 The time in seconds a model is locked.
MIX_HEARTBEAT_REFRESH 60 The time in seconds between the heartbeats. Should be a multiple of the MIX_HEARTBEAT_STATUS-interval.
MIX_HEARTBEAT_STATUS 30 The time in seconds between the heartbeats for status-request (index-Listener).
MIX_HEARTBEAT_ENABLED true Activates or deactivates the heartbeats.

config

Beside the environment variables, there is a middleware key to determine the middleware(s) used by the heartbeat-route. Default it's set to api.


All versions of laravel-model-locking with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
spatie/temporary-directory Version ^2.1
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 hyperlink/laravel-model-locking contains the following files

Loading the files please wait ....