am2studio/laravel-finite

Service provider for finite

1.0.2 2016-02-03 19:17 UTC

This package is not auto-updated.

Last update: 2024-10-08 20:31:27 UTC


README

Latest Version on Packagist Software License Total Downloads

Install

Via Composer

$ composer require AM2studio/Laravel-Finite

in config/app.php

under 'providers' add

AM2Studio\LaravelFinite\LaravelFiniteServiceProvider::class,

under 'alias' add

'Finite'    => AM2Studio\LaravelFinite\FiniteFacade::class,

publish migration files and run migration

php artisan vendor:publish --provider="AM2Studio\LaravelFinite\LaravelFiniteServiceProvider" --tag="migrations"
php artisan migrate

Usage

In models you want to use it add namespace

use AM2Studio\LaravelFinite\Traits\LaravelFiniteTrait;

and then use trait

use LaravelFiniteTrait;
Finite::can($eloquentModelObject, 'finite transition');
Finite::apply($eloquentModelObject, 'finite transition');
Finite::getName($eloquentModelObject));

It is recommended that you use Relation::morphTo([]) because that way if you change the namespace of your model the records in DB won't break.

Change log

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Credits

License

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