toArray(); } /** * Return the eggs associated with this mount. * * @throws \App\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeEggs(Mount $mount): Collection|NullResource { if (!$this->authorize(AdminAcl::RESOURCE_EGGS)) { return $this->null(); } $mount->loadMissing('eggs'); return $this->collection( $mount->getRelation('eggs'), $this->makeTransformer(EggTransformer::class), 'egg' ); } /** * Return the nodes associated with this mount. * * @throws \App\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeNodes(Mount $mount): Collection|NullResource { if (!$this->authorize(AdminAcl::RESOURCE_NODES)) { return $this->null(); } $mount->loadMissing('nodes'); return $this->collection( $mount->getRelation('nodes'), $this->makeTransformer(NodeTransformer::class), 'node' ); } /** * Return the servers associated with this mount. * * @throws \App\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeServers(Mount $mount): Collection|NullResource { if (!$this->authorize(AdminAcl::RESOURCE_SERVERS)) { return $this->null(); } $mount->loadMissing('servers'); return $this->collection( $mount->getRelation('servers'), $this->makeTransformer(ServerTransformer::class), 'server' ); } }