pppcreative/reviews

创建 Reviews 表格、模型、观察者

dev-main 2023-04-04 10:36 UTC

This package is auto-updated.

Last update: 2024-09-04 13:45:27 UTC


README

预览

preview

用法

  • 注册提供者
Wame\Review\ReviewServiceProvider::class,
  • 使用 vendor publish -- reviewServiceProvider
php artisan vendor:publish --provider="Wame\Reviews\ReviewServiceProvider"
  • 为观察者和监听器添加 EventServiceProvieder
   /**
     * The event to listener mappings for the application.
   */
 protected $listen = [
       ReviewCreatingEvent::class => [RunReviewCreatingListenerJob::class],
       ReviewUpdatingEvent::class => [RunReviewUpdatingListenerJob::class],
       ReviewUpdatedEvent::class => [RunReviewUpdatedListenerJob::class],
 ];
  /**
    * Register any events for your application.
   */
public function boot(): void
{
     Review::observe(ReviewObserver::class);
}
  • 添加到 Nova 菜单
  MenuItem::resource(Review::class),
  • config/reviews.php 中设置类型模型或编辑标签颜色
    'types' => [
        User::class,
        Order::class,
    ],
   'status_use' => true,
  • 编辑翻译 resources/lang/sk/reviews.php
  "waiting" => "čakajúci",
  "approved" => "schválený",
  "denied" => "zamietnutý",
  "finished" => "hotové",
  "edit" => "upraviť",