exceptio / laravel-approval
Dynamic Approval Package For Laravel Framework
- dev-master
- v1.0.59
- v1.0.58
- v1.0.57
- v1.0.56
- v1.0.55
- v1.0.54
- v1.0.53
- v1.0.52
- v1.0.51
- v1.0.50
- v1.0.49
- v1.0.48
- v1.0.47
- v1.0.46
- v1.0.45
- v1.0.44
- v1.0.43
- v1.0.42
- v1.0.41
- v1.0.40
- v1.0.39
- v1.0.38
- v1.0.37
- v1.0.36
- v1.0.35
- v1.0.34
- v1.0.33
- v1.0.32
- v1.0.31
- v1.0.30
- v1.0.29
- v1.0.28
- v1.0.27
- v1.0.26
- v1.0.25
- v1.0.24
- v1.0.23
- v1.0.22
- v1.0.21
- v1.0.20
- v1.0.19
- v1.0.18
- v1.0.17
- v1.0.16
- v1.0.15
- v1.0.14
- v1.0.13
- v1.0.12
- v1.0.11
- v1.0.10
- v1.0.9
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
This package is auto-updated.
Last update: 2025-04-27 03:33:26 UTC
README
A Dynamic package for handling model based approval process in Laravel.
Installation
This package is very easy to set up. There are only couple of steps.
Composer
Pull this package in through Composer
composer require exceptio/laravel-approval
Service Provider
-
Laravel 5.5 and up Uses package auto discovery feature, no need to edit the
config/app.php
file. -
Laravel 5.4 and below Add the package to your application service providers in
config/app.php
file.
'providers' => [ ... /** * Third Party Service Providers... */ Exceptio\ApprovalPermission\ApprovalPermissionServiceProvider::class, ],
Config File
Publish the package config file to your application. Run these commands inside your terminal.
php artisan vendor:publish --provider="Exceptio\ApprovalPermission\ApprovalPermissionServiceProvider" --tag="config"
you may set approvalpermission-enable
to false
to disable the feature.
you may set do-migration
to false
in config file to disable the migration.
Note: database must have all the necessary tables and columns if you disable migration.
View Files
Publish the view file to your application. Run these commands inside your terminal.
php artisan vendor:publish --provider="Exceptio\ApprovalPermission\ApprovalPermissionServiceProvider" --tag="views"
Migration File
Publish the package migration file to your application. Run these commands inside your terminal.
php artisan vendor:publish --provider="Exceptio\ApprovalPermission\ApprovalPermissionServiceProvider" --tag="migration"
Notificaiton File
Publish the package notificaiton file to your application. Run these commands inside your terminal.
php artisan vendor:publish --provider="Exceptio\ApprovalPermission\ApprovalPermissionServiceProvider" --tag="notificaiton"
Approvable Trait
- Include
Approvable
trait to a class for approval process. See example below.
Example Approvable
Trait:
<?php namespace App\Repositories; use App\Models\User; use App\Models\Member; use Exceptio\ApprovalPermission\Approvable; class MemberRepository { use Approvable; const DRAFT_DATA = 0; // Draft member const PENDING_DATA = 1; // Pending member // rest of your code ... }
Migrations and seeds
This uses the default users table which is in Laravel. You should already have the migration file for the users table available and migrated.
- Setup the needed tables:
php artisan migrate
- For seeder publish
php artisan vendor:publish --provider="Exceptio\ApprovalPermission\ApprovalPermissionServiceProvider" --tag="seeder"
- Seed an initial set of Approval sample data.
composer dump-autoload
php artisan db:seed --class="ApprovalSeeder"
And that's it!
Usage
Creating Process
<?php use App\Models\User; use App\Models\Member; use Exceptio\ApprovalPermission\Approvable; class MemberRepository { use Approvable; const DRAFT_DATA = 0; // Draft member const PENDING_DATA = 1; // Pending member public function createStepFinal(Request $request) { $member = new Member::create([ 'name' => 'Test Member', //so on ]); $this->notifyApprovalCreate($member); }
Blade Extensions
The Blade extensions.
@approvalMenu() //Show Approval menu in your application
Config File
You can change user model name, primary key and other settings in config. Have a look at config file for more information.
Opening an Issue
Before opening an issue there are a couple of considerations:
- A star on this project shows support and is way to say thank you to all the contributors. If you open an issue without a star, your issue may be closed without consideration. Thank you for understanding and the support.
- Read the instructions and make sure all steps were followed correctly.
- Check that the issue is not specific to your development environment setup.
- Provide duplication steps.
- Attempt to look into the issue, and if you have a solution, make a pull request.
- Show that you have made an attempt to look into the issue.
- Check to see if the issue you are reporting is a duplicate of a previous reported issue.
- Following these instructions show me that you have tried.
- If you have a questions send me an email to zahid@exceptionsolutions.com
- Please be considerate that this is an open source project that I provide to the community for FREE when opening an issue.
License
Dynamic Approval Permission For Laravel Project by Exception Solutions is marked with CC0 1.0 Universal