coolify/app/Livewire/Project/Shared/Storages/All.php

24 lines
568 B
PHP
Raw Normal View History

2023-05-05 10:08:38 +00:00
<?php
2023-12-07 18:06:32 +00:00
namespace App\Livewire\Project\Shared\Storages;
2023-05-05 10:08:38 +00:00
use Livewire\Component;
class All extends Component
{
2023-08-07 20:14:21 +00:00
public $resource;
2024-06-10 20:43:34 +00:00
protected $listeners = ['refreshStorages' => '$refresh'];
public function getFirstStorageIdProperty()
{
if ($this->resource->persistentStorages->isEmpty()) {
return null;
}
// Use the storage with the smallest ID as the "first" one
// This ensures stability even when storages are deleted
return $this->resource->persistentStorages->sortBy('id')->first()->id;
}
2023-05-05 10:08:38 +00:00
}