定制 dizatech/tag 二次开发

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

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

dizatech/tag

Composer 安装命令:

composer require dizatech/tag

包简介

A full package for attach tags to all of models in laravel.

README 文档

README

Latest Version on Packagist GitHub issues GitHub stars GitHub forks Total Downloads GitHub license

A laravel package for manage your tags, that use ajax, bootstrap, select2 and sweetalert2 for client side and use from many to many polymorphic relationship in models.

How to install and config dizatech/tag package?

composer require dizatech/tag

Install and publish files

Publish 'lacopa' packages pages:
php artisan tag:install --lacopa | --lacopa --force | -l -f | -lf

Publish empty pages for another projects:
php artisan tag:install --force | -f 

Use create and edit input components

Use this component in your 'create' pages:
<x-tag></x-tag>
OR set custom properties, defaults: label="برچسب‌ها" name="tags" page="create"
<x-tag label="برچسب‌ها" name="tags" page="create"></x-tag>

And use this component in your 'edit' pages:
<x-tag page="edit" id="{{ $post->id }}" $model="{{ get_class($post) }}"></x-tag>
Use this Blade tag in your page:
@tagScripts()

OR use this tag in script section of page:
@slot('script')

    @tagScripts()

@endslot

Use index, create and edit pages and customize this pages

  • If you use from lacopa add below code in your sidebar:

    @component('tag::components.sidebar.menu')@endcomponent
    
  • If you want to use tag package in another project, you can use /resources/views/vendor/tag directory

    Use below component in your create page structure:
    <x-tag-create></x-tag-create>
    
    Use below component in your edit page structure:
    <x-tag-edit tag="{{ $tag->id }}"></x-tag-edit>
    
    Use below component in your index page structure:
    <x-tag-index></x-tag-index>

Config files options

<?php

return [
    // Minimum Input Length for search keyword
    'minimumInputLength' => 2,

    // Recommended: Set your models that has many-to-many-polymorphic relation with Tag model
    'morphedByMany' => [
        // For example
        // 'articles'  => 'App\Models\Article',
    ],
];

// Notice: if you update 'morphedByMany' option, use this command each time
php artisan tag:reload

Set the Taggable Trait on models

<?php

namespace Modules\Course\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Dizatech\Tag\Services\Traits\Taggable;

class Post extends Model
{
    use HasFactory, SoftDeletes, Taggable;
}

Attach tags to models

<?php

$post->tags()->sync($request->tags);

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 2
  • Forks: 1
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-06-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固