定制 imjonos/laravel-emoji-reaction 二次开发

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

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

imjonos/laravel-emoji-reaction

Composer 安装命令:

composer require imjonos/laravel-emoji-reaction

包简介

Laravel emoji reaction package

README 文档

README

v0.1a - test version

img.png

Based on Unicode emoji characters. The default list can be find in the config file.

Full unicode emojis list: https://unicode.org/emoji/charts/full-emoji-list.html

Live Demo: https://toprogram.ru/posts

Code example and usage: https://github.com/imjonos/laravel-blog

Installation

Via Composer

$ composer require imjonos/laravel-emoji-reaction
$ php artisan vendor:publish --provider="Nos\EmojiReaction\EmojiReactionServiceProvider"
$ php artisan migrate

Usage

Front-end component example https://github.com/imjonos/laravel-blog/blob/master/resources/js/components/EmojiReaction.vue

Back-end part

    //Model 
    
    use Nos\EmojiReaction\Interfaces\Models\EmojiReactionInterface;
    use Nos\EmojiReaction\Traits\HasEmojiReactionTrait;
    
    final class Post extends Model implements EmojiReactionInterface
    {
        use HasEmojiReactionTrait;
    ...
    
   
    // Routes
    Route::post('/posts/{post}/emoji-reactions', [\App\Http\Controllers\PostController::class, 'addEmojiReaction'])->name(
        'site.posts.add-emoji-reaction'
    );
    Route::get('/posts/{post}/emoji-reactions', [\App\Http\Controllers\PostController::class, 'getEmojiReactionStatistic']
    )->name(
        'site.posts.get-emoji-reaction-statistic'
    );
    
    //Controller
    public function getEmojiReactionStatistic(Post $post): JsonResponse
    {
        return response()->json($this->reactionStatisticService->getByModel($post));
    }

    /**
     * @throws Exception
     */
    public function addEmojiReaction(AddEmojiReactionRequest $request, Post $post): JsonResponse
    {
        $emoji = $this->emojiService->find($request->get('emoji_id'));
        abort_if(!$emoji, 400);

        DB::transaction(function () use ($post, $request, $emoji) {
            $this->reactionService->addReaction($post, $emoji);
        });

        return response()->json();
    }

Contributing

Please see contributing.md for details and a todolist.

License

license. Please see the license file for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-02-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固