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
|
|
|
|
2024-08-05 18:00:57 +00:00
|
|
|
protected $listeners = ['refreshStorages' => '$refresh'];
|
2025-09-11 11:41:22 +00:00
|
|
|
|
|
|
|
|
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
|
|
|
}
|