Download the PHP package dropoutventures/model-requirements without Composer
On this page you can find all versions of the php package dropoutventures/model-requirements. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dropoutventures/model-requirements
More information about dropoutventures/model-requirements
Files in dropoutventures/model-requirements
Package model-requirements
Short Description Laravel Model Requirements
License MIT
Homepage https://github.com/dropoutventures/model-requirements
Informations about the package model-requirements
Laravel Model Requirements
With this package you can assign requirements to models based on their relationships. Requirements should be used where you are expecting some sort of Setting to be saved. The Requirement model can be expanded to add other fields like if the rquirement is optional, what type of input the field should be, and more.
Examples
- Add a Requirement to a Page using a specific Integration's Action
- Add a Requirement to a Brand using a specific Theme
- Add a Requirement to an Input if you are using a specific Integration
- Add a Requirement to a Page if that page has a specific Input
Installation
You can install the package via composer:
You can publish and run the migrations with:
You can publish the config file with:
This is the contents of the default config file:
Usage
Global Requirements
Sometimes you may need an application wide setting for a model type that doesn't have a specific parent. If there is no Parent for the Requirement it will not currently check the relationships, just check the matching attributes.
This applies the
classes
Requirement to all Input models.
Owns Requirements
Use the OwnsRequirements
Trait on Models that will be the parent and create requirements.
/Models/Integration.php
Has Requirements
Use the HasRequirements
Trait on Models that will receive the requirements.
/Models/Page.php
/Seeders/FunnelPageSeeder.php
/Controllers/FunnelPageController.php
TODO List
- [x] Enum Value Support
- [x] Pivot Relationship Support
- [ ] Relationship By Class Names
- [ ] Require Another Model Instead of Parent
Credits
- jjjrmy
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of model-requirements with dependencies
spatie/laravel-package-tools Version ^1.9.2
illuminate/contracts Version ^9.0