*/ public function protocol(): HasOne { return $this->hasOne(ConnectionProtocol::class, 'id', 'connection_protocol_id'); } /** * @return BelongsTo */ public function provider(): BelongsTo { return $this->belongsTo(ConnectionProvider::class, 'connection_provider_id'); } /** * @return HasOne */ public function status(): HasOne { return $this->hasOne(ConnectionStatus::class, 'id', 'connection_status_id'); } public function getActivitylogOptions(): LogOptions { return LogOptions::defaults() ->logFillable() // Log all fillable attributes ->logOnlyDirty() // Log only attributes that actually changed ->dontLogIfAttributesChangedOnly(['updated_at']) // Skip if only updated_at changed ->dontLogEmptyChanges() // Prevent saving logs with no changed attributes ->setDescriptionForEvent(fn ( string $eventName ) => ":causer.name {$eventName} connected app ':subject.name'"); } public function roles(): BelongsToMany { return $this->belongsToMany( Role::class, 'app_roles', 'app_id', 'role_id', ) ->using(AppRole::class) ->withPivot('duration'); } }