dongxixia6399 2017-12-14 06:57
浏览 62
已采纳

如何在Laravel 5.5中实现事件

The Laravel Eloquent Event docs give this example:

namespace App;

use App\Events\UserSaved;
use App\Events\UserDeleted;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use Notifiable;

    /**
     * The event map for the model.
     *
     * @var array
     */
    protected $dispatchesEvents = [
        'saved' => UserSaved::class,
        'deleted' => UserDeleted::class,
    ];
}

I simply want to know what would go in a UserSaved::class to, let's say, add a hash id on the initial save. The docs are frustratingly opaque at this point!

  • 写回答

2条回答 默认 最新

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥15 一个python问题
      • ¥15 您好,请问您的那个pcap转成pcd文件的matlab代码我下载了运行没问题,也生成了点云图,但是无法存储pcd文件,请问怎么保存导出pcd文件呀
      • ¥60 已有标注好的图像数据集,如何构建深度卷积网络训练分类
      • ¥20 matlab图像错误
      • ¥30 如何写通过uni.uploadFile上传图片到ASP后端接收的代码
      • ¥15 selenium模糊定位
      • ¥15 硬件断点的问题,真的被整无语了
      • ¥30 想入门网络编程求建议
      • ¥15 在Vs图形库编程中引入的tools.h文件为什么不能被解析,SEL检查已经关闭(语言-c++)
      • ¥15 mybatis的映射文件提示