Download the PHP package narcisonunez/laravel-actionable-model without Composer

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

Allow actions in your laravel model

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Allow models to perform or receive actions.

Installation

You can install the package via composer:

You can publish and run the migrations with:

Basic Setup

Register your actions

Add your action in your AppServiceProvider

You can implement your own class extending ActionableTypeRecord to add more logic to your records.
Ex. icon method to get that specific action type icon. Now, Any kudos action will have a method named icon.

Your actions will be used as dynamic method calls. See below.

Create a new Actionable Action Type (OPTIONAL)

Add aliases to your models (OPTIONAL)

Add your aliases in your AppServiceProvider

Storing aliases in the database will prevent losing the reference if you move your models to another directory.

Update existing models references to use the new alias

In case you already have data in the database, after adding the aliases you can run:

If you want just to update a specific value

To update all your existing records.

Traits

A model that can perform actions you need to include:

The model that can receive the actions must implement CanBeActionable

Basic Usage

Perform an action

Check if the action was already made

Toggle your actions

Manually delete an action (See Toggle above)

Get all the actions

- Available methods -

Method Description
get Returns a collection of ActionableTypeRecord
count Returns the number of records
given Filters all the records where the current model performed the actions
received Filters all the records where the current model received the actions
ofType Filters by the actionType
by Filters all the actions in the current model where the model passed to this method performed the action
latest Get the collection sorted by the latest ones.

Actionable Record

The methods above will return a collection of ActionableRecord.
The access the owner or the actionable models, you can do it like this:

💖 Support the development

Do you like this project? Support it by donating

License

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


All versions of laravel-actionable-model with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
spatie/laravel-package-tools Version ^1.4.3
illuminate/contracts Version ^8.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 narcisonunez/laravel-actionable-model contains the following files

Loading the files please wait ....