$model->id, 'server' => $model->server_id, 'host' => $model->database_host_id, 'database' => $model->database, 'username' => $model->username, 'remote' => $model->remote, 'max_connections' => $model->max_connections, 'created_at' => $model->created_at->toAtomString(), 'updated_at' => $model->updated_at->toAtomString(), ]; } /** * Include the database password in the request. */ public function includePassword(Database $model): Item { return $this->item($model, function (Database $model) { return [ 'password' => $model->password, ]; }, 'database_password'); } /** * Return the database host relationship for this server database. * * @throws \App\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeHost(Database $model): Item|NullResource { if (!$this->authorize(DatabaseHost::RESOURCE_NAME)) { return $this->null(); } $model->loadMissing('host'); return $this->item( $model->getRelation('host'), $this->makeTransformer(DatabaseHostTransformer::class), DatabaseHost::RESOURCE_NAME ); } }