Пример #1
0
 /**
  * 监听创建事件
  */
 public static function boot()
 {
     parent::boot();
     self::creating(function ($user) {
         $primaryKey = $user->get_primary_key();
         if (!isset($user[$primaryKey])) {
             $user[$primaryKey] = BaseModel::get_unique_id(self::$id_prefix);
         }
         return true;
     });
 }