定制 zing/laravel-eloquent-tags 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

zing/laravel-eloquent-tags

Composer 安装命令:

composer require zing/laravel-eloquent-tags

包简介

Manage tags for Laravel eloquent

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License

Requires PHP 8.0+

Require Laravel Eloquent Tags using Composer:

composer require zing/laravel-eloquent-tags

Usage

use Zing\LaravelEloquentTags\Tests\Models\Product;
use Zing\LaravelEloquentTags\Tag;

$product = Product::query()->first();
// Add tag(s) to model
$product->attachTag("tag");
$product->attachTags([
    "tag",
    Tag::query()->first()
]);
// Remove tag(s) from model
$product->detachTag("tag");
$product->detachTags([
    "tag",
    Tag::query()->first()
]);
// Reset tags of model
$product->syncTags([
    "tag",
    Tag::query()->first()
]);
// Get tags of model
$product->tags;
// Eager load tags
$products = Product::query()->with('tags')->withCount('tags')->get();
$products->each(function (Product $product){
    $product->tags->dump();
    $product->tags_count;
});
// Query by tag
Product::query()->withAnyTags(['tag', 'github'])->exists(); // true
Product::query()->withAllTags(['tag', 'github'])->exists(); // false

License

Laravel Eloquent Tags is an open-sourced software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-10-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固