refactor: Update code to use str() instead of Str::of() for string manipulation

This commit is contained in:
Andras Bacsai
2024-06-25 10:37:10 +02:00
parent 1266810c4d
commit 2c92cc40e1
38 changed files with 101 additions and 126 deletions

View File

@@ -3,7 +3,6 @@
namespace App\Livewire\Project\Application;
use App\Models\Application;
use Illuminate\Support\Str;
use Livewire\Component;
use Visus\Cuid2\Cuid2;
@@ -50,16 +49,16 @@ class Rollback extends Component
$output = instant_remote_process([
"docker inspect --format='{{.Config.Image}}' {$this->application->uuid}",
], $this->application->destination->server, throwError: false);
$current_tag = Str::of($output)->trim()->explode(':');
$current_tag = str($output)->trim()->explode(':');
$this->current = data_get($current_tag, 1);
$output = instant_remote_process([
"docker images --format '{{.Repository}}#{{.Tag}}#{{.CreatedAt}}'",
], $this->application->destination->server);
$this->images = Str::of($output)->trim()->explode("\n")->filter(function ($item) use ($image) {
return Str::of($item)->contains($image);
$this->images = str($output)->trim()->explode("\n")->filter(function ($item) use ($image) {
return str($item)->contains($image);
})->map(function ($item) {
$item = Str::of($item)->explode('#');
$item = str($item)->explode('#');
if ($item[1] === $this->current) {
// $is_current = true;
}