public static function boot() { parent::boot(); // When first creating the model generate a webhook hash static::creating(function (Heartbeat $model) { if (!array_key_exists('hash', $model->attributes)) { $model->generateHash(); } }); }