am2studio / laravel-finite by msamec

Service provider for finite
5,087
3
4
Package Data
Maintainer Username: msamec
Maintainer Contact: marko.samec@am2studio.hr (Marko Šamec)
Package Create Date: 2016-01-21
Package Last Update: 2022-11-15
Language: PHP
License: MIT
Last Refreshed: 2024-11-23 03:16:59
Package Statistics
Total Downloads: 5,087
Monthly Downloads: 1
Daily Downloads: 0
Total Stars: 3
Total Watchers: 4
Total Forks: 1
Total Open Issues: 1

Laravel-Finite

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.