Download the PHP package laravel-ready/model-support without Composer
On this page you can find all versions of the php package laravel-ready/model-support. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download laravel-ready/model-support
More information about laravel-ready/model-support
Files in laravel-ready/model-support
Package model-support
Short Description Useful model support traits
License MIT
Informations about the package model-support
ModelSupport
๐ About
Useful eloquent model support traits.
๐ฆ Installation
Get via composer
โ๏ธ Configs
Example Trait Usage
๐ Usage
HasLanguage
This trait allows you to get models by language.
Note Field name is
langby default. You can change it in the config file.
Sluggable
This trait allows you to generate a slug from a string. When you create a new model, the slug will be generated automatically. If you change the title, the slug will also be updated. See bootSluggable() method for more details.
Note Field names are
slugandtitleby default. You can change it in the config file.
SluggableTitle
This trait allows you to generate a slug from a title field. Same as Sluggable trait but it only works with the title field.
Note Field names are
slugandtitle(hardcoded, not configurable).
SluggableName
This trait allows you to generate a slug from a name field. Same as Sluggable trait but it only works with the name field.
Note Field names are
slugandname(hardcoded, not configurable).
ParentChild
This trait allows you to work with parent-child relationships in self-referencing models.
Note Field name is
parent_idby default. You can change it in the config file.Warning It's only supports self-referencing models.
HasActive
This trait allows you to get active/inactive status models.
Note Field name is
is_activeby default. You can change it in the config file.Warning This trait forces your models to fillable
is_activefield and addsis_activecast toboolean.
๐งช Testing
This package uses Pest PHP for testing and is tested across multiple PHP and Laravel versions.
Running Tests
Static Analysis
Test Matrix
The package is automatically tested against:
| PHP Version | Laravel 10.x | Laravel 11.x | Laravel 12.x |
|---|---|---|---|
| 8.1 | โ | โ | โ |
| 8.2 | โ | โ | โ |
| 8.3 | โ | โ | โ |
| 8.4 | โ | โ | โ |
| 8.5 | โ | โ | โ |
Tests run automatically on every push and pull request via GitHub Actions.
Local Testing
By using act you can run all test matrix locally (requires Docker).
โ Credits
- This project was generated by the packager.
All versions of model-support with dependencies
illuminate/support Version ^12.4 || ^11.8 || ^10.0