Download the PHP package abather/spatie-laravel-model-states-actions without Composer

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

spatie-laravel-model-states-actions

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

with this package you can display or add actions to your views using state, this package depends on spatie/laravel-model-states package.

Installation

You can install the package via composer:

Usage

Follow the Doc in Laravel-model-states , but for each State you have to extends Abather\SpatieLaravelModelStatesActions\State :

configure authorization

you can define ability name for each state that well be used to determine if the user can change the state or not as:

that mean it well look to ability name called cancel in OrderPolicy class.

also you can skip authorization by override the attribute $skip_authorization = true

keep in mind that the package also chick if you can transfer to the state using canTransitionTo(Cancel::class) that come with Spatie Package you can view it here

Customize Action Icon & Color

you can custom the state color and icon by overriding the attributes $color & $icon

for these attributes you have to follow Filament Doc about each one of them Icon Doc, Color Doc

Localization

you need to create states.php file to translate the state and the structure of each state should be as:

Display Current State

if you went to display the current state in Edit or Info List you can do so by adding state->display() method to header actions:

feel free to add it to any place that accept Filament\Actions\Action object.

View actions in Table:

you can view the available actions 'depends on authorizations as states configuration':

tableActions() method well return an array of Filament\Tables\Actions\Action objects.

View actions in any page

you can view the available actions 'depends on authorizations as states configuration' in any resource page:

actions() will return an array of Filament\Actions\Action objects, that mean you can use it any place that accept Action object.

Config ordering actions

if you went to display available actions in specific order you can do so by overriding $order attribute in each State.

action without confirmation modal

if you don't went the conformation modal you can set attribute $requires_confirmation to false in the state:

or change it in the base state class:

this will stop confirmation modal to all states under this class.

Testing

Changelog

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

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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


All versions of spatie-laravel-model-states-actions with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^10.0||^11.0
spatie/laravel-model-states Version ^2.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 abather/spatie-laravel-model-states-actions contains the following files

Loading the files please wait ....