Download the PHP package hxm/laravel-planning without Composer
On this page you can find all versions of the php package hxm/laravel-planning. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-planning
Laravel Planning
Laravel Planning is a library that supports creating and managing plans in Laravel projects.
- Features
- Requirements
- Installation
- Configuration
- Default Configurations
- Directory Tree Representation
- Resource Management
- Implementing PlanResourceInstance
- Panel Management
- Using the Panel
- Usage
- Creating a Plan Order for a Resource
- Managing Plan Cycles
- Querying Resources with Cycles
- Contact
- Contribution
- License
Features
- Flexible plan and item management
- Event-driven actions and listeners
- Built-in scheduling and cron job support
- Customizable panel interface
Requirements
- PHP >= 7.4
- Laravel >= 7.x
Installation
Install the package via Composer:
Configuration
After installation, you can publish the configuration file using the following command:
You can also publish the migration files using:
Default Configurations
Below are the default configurations:
Directory Tree Representation
Resource Management
The plans operate based on resource models. To create a plan for App\User
, add it to the resources
array in the configuration file:
Alternatively, you can dynamically add resources in the AppServiceProvider
:
Implementing PlanResourceInstance
Before creating plan cycles for a resource (e.g., User
), you must implement the PlanResourceInstance
interface in your model and use the HasPlanResourceInstance
trait:
Panel Management
Laravel Planning provides a built-in panel interface to manage plans. The panel settings are defined in the configuration under the pannel
key:
By default, the panel is enabled. You can disable it by setting "enable"
to false
. If the panel is disabled, you will need to create your own implementation for managing plans.
To access the panel, visit:
Using the Panel
- Navigate to the
Create
section to create a new plan via the form. - Once a plan is created, add items to it. These items represent the features or content activated by the plan. Costs and prices can be set for each item.
- If the cycle is set to
0
, the items will repeat across cycles.
Usage
Here is an example of how to use the library:
Creating a Plan Order for a Resource
To create a plan order for a User
resource:
Managing Plan Cycles
After saving the plan order, you can retrieve its cycles:
You can associate a payment with the retrieved cycle:
By default, the plan cycle will have a status of inactive
(status = 0
). You can define your custom logic for handling this state.
To update the cycle's status, you can use:
When a cycle's status is updated to 1
, a schedule is automatically created to generate the next cycle. The schedule's configuration is defined in the config file. You can listen for events such as PlanCycleCreatedEvent
or PlanCycleUpdatedStatusEvent
to add custom logic when new cycles are created or their statuses are updated.
Querying Resources with Cycles
You can query resources along with their current cycles:
Or retrieve a list of users with active cycles (status = 1
):
Contact
Please contact me if you need assistance Email.
You can also donate to me at Paypal
Contribution
We welcome contributions! Please follow these steps:
- Fork the repository.
- Create a new branch:
git checkout -b new-feature
. - Commit your changes:
git commit -m 'Add new feature'
. - Push to your branch:
git push origin new-feature
. - Submit a pull request.
License
This package is open-sourced software licensed under the MIT license.
All versions of laravel-planning with dependencies
illuminate/support Version ^7.0|^8.0|^9.0|^10.0|^11.0
yajra/laravel-datatables-oracle Version ^9.0