vcoder7 / ltools
Laravel helper tools
1.0.2
2026-01-14 12:55 UTC
Requires
- php: ^8.2|^8.3|^8.4
- illuminate/console: ^10.0|^11.0|^12.0
- illuminate/database: ^10.0|^11.0|^12.0
- illuminate/support: ^10.0|^11.0|^12.0
Requires (Dev)
- laravel/pint: ^1.27
- mockery/mockery: ^1.6
- orchestra/testbench: ^9.0|^10.0
- phpunit/phpunit: ^11.0|^12.0
README
Laravel helper tools
- Cache clear command
- Automatic
uuidfield value generation - Str
initialshelper (macro) - Changelog integration
Installation
composer require vcoder7/ltools
Clear application, route, config and view cache
php artisan ltools:cache-clear
Automatic uuid field value generation
- Add to your migration
$table->uuid()->unique(); - Add to your model:
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Vcoder7\Ltools\Http\Traits\CreateUuidTrait;
class MyModel extends Model
{
use HasFactory, CreateUuidTrait;
}
Str initials helper (macro)
The Str::initials() macro returns the uppercase initials of a given name string. It intelligently trims whitespace and handles multi-word names.
Usage:
use Illuminate\Support\Str;
Str::initials('John Peter Smith'); // Returns: "JPS"
Changelog integration
Setup:
Publish config:
php artisan vendor:publish --tag=ltools-config
Publish migrations:
php artisan vendor:publish --tag=ltools-migrations
Enable changelogs for one model, add to the model Vcoder7\Ltools\Http\Traits\RecordChangesTrait
Example:
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Vcoder7\Ltools\Http\Traits\RecordChangesTrait;
class Page extends Model
{
use RecordChangesTrait;
}
Exclude fields from change logging
Add to your model:
protected array $excludedChangelogFields = ['created_at', 'updated_at', 'email', 'secret_key'];
Get changelogs for model
$page = Page::find(1);
$changelogs = $page->changelogs;
PGSQL driver check
$table->isPgsqlDriver(function (Blueprint $table) {
$table->jsonb('options')->nullable();
})->else(function (Blueprint $table) {
$table->json('options')->nullable();
});