承接 vcoder7/ltools 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

vcoder7/ltools

最新稳定版本:v1.0.1

Composer 安装命令:

composer require vcoder7/ltools

包简介

Laravel helper tools

README 文档

README

Laravel helper tools

Installation

composer require vcoder7/ltools

Clear application, route, config and view cache

php artisan ltools:cache-clear

Automatic uuid field value generation

  1. Add to your migration $table->uuid()->unique();
  2. 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;

统计信息

  • 总下载量: 1.71k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-08-11