承接 nutnet/laravel-comments 相关项目开发

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

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

nutnet/laravel-comments

Composer 安装命令:

composer require nutnet/laravel-comments

包简介

Extension for actuallymab/laravel-comment package. Allow comment as guest and add other meta-info.

README 文档

README

Original laravel-comment package is a good start point for creating commenting system on laravel, but package doesn't allow(out of the box) attach some meta about user or comment, or comment as guest. This extension fix this issues.

Install and configure

To install package, run:

composer require nutnet/laravel-comments

Next, enable package by adding service provider to your app config:

// config/app.php
'providers' => [
    ...
    Nutnet\LaravelComments\ServiceProvider::class,
    ...
];

Optionally add alias for Nutnet\LaravelComments\Facades\Commenter facade.

Usage

All usage is identical to original package, except some moments:

  1. Use Nutnet\LaravelComments\CanComment trait instead of original.
  2. Use Nutnet\LaravelComments\Commentable trait instead of original.
  3. Use Nutnet\LaravelComments\Models\Comment model instead of original.
As authorized user:
use Nutnet\LaravelComments\Services\Commenter;
use Nutnet\LaravelComments\Facades\Commenter as CommenterFacade;

// ... some other code

public function comment(Commenter $commenter)
{
    // variant 1
    $commenter->comment($product, 'Test comment', $user, ['meta' => 'test']);
    
    // variant 2, without meta
    $user->comment($product, 'Test comment', $rate);
    
    // variant 3
    CommenterFacade::comment($product, 'Test comment', $user, ['meta' => 'test']);
}
As guest:
use Nutnet\LaravelComments\Services\Commenter;
use Nutnet\LaravelComments\Facades\Commenter as CommenterFacade;

// ... some other code

public function comment(Commenter $commenter)
{
    // variant 1
    $commenter->commentAsGuest($product, 'Test comment', ['meta' => 'test']);
    
    // variant 2, without meta
    CommenterFacade::commentAsGuest($product, 'Test comment', ['meta' => 'test']);
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-09-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固