laracraft-tech/laravel-useful-additions
A handy set of practical Laravel additions that reduce boilerplate and simplify everyday development. With drop-in helpers and macros for common patterns, it keeps your code cleaner, more expressive, and easier to reuse across projects.
composer require laracraft-tech/laravel-useful-additions. For Laravel 13 projects, require ^4.3 (the first release with Laravel 13 support).use LaracraftTech\LaravelUsefulAdditions\Traits\HasUuid;
use LaracraftTech\LaravelUsefulAdditions\Traits\HasSlug;
class Post extends Model
{
use HasUuid, HasSlug;
}
Migration:
$table->uuid('id')->primary();
$table->string('slug')->unique();
HasUuid / HasUlid handle primary-key generation on create; HasSlug generates slugs from a source column; HasJsonAttributes casts JSON columns to arrays; HasSortable supports ordered records; HasTags adds polymorphic tagging.HasUuid and HasUlid on the same model. Keep slug and sortable traits on models that actually need those columns.title) per the README, then let the trait generate on creating. Add a unique index and handle collisions in application code if needed.HasJsonAttributes instead of manually casting JSON columns when you want array access and dirty tracking. Keep the database column type as json or text.HasSortable for drag-and-drop ordering. Wrap reorder operations in transactions and index the order column.^4.3; no breaking changes are called out in the release notes.composer why-not laracraft-tech/laravel-useful-additions if installation fails.HasUuid and HasUlid together. If a model already defines boot() or bootTraitName(), verify the trait boot methods still run.$casts for a JSON column, HasJsonAttributes may overlap. Pick one approach per attribute.booted/creating events and dump $model->getAttributes() after create(). Trait boot methods are easy to miss in large models.composer update is low risk. Run your model/factory tests after upgrading to confirm trait behavior.How can I help you explore Laravel packages today?