refactor: Update code to use str() instead of Str::of() for string manipulation
This commit is contained in:
@@ -28,11 +28,11 @@ class Application extends BaseModel
|
||||
}
|
||||
$application->forceFill([
|
||||
'fqdn' => $application->fqdn,
|
||||
'install_command' => Str::of($application->install_command)->trim(),
|
||||
'build_command' => Str::of($application->build_command)->trim(),
|
||||
'start_command' => Str::of($application->start_command)->trim(),
|
||||
'base_directory' => Str::of($application->base_directory)->trim(),
|
||||
'publish_directory' => Str::of($application->publish_directory)->trim(),
|
||||
'install_command' => str($application->install_command)->trim(),
|
||||
'build_command' => str($application->build_command)->trim(),
|
||||
'start_command' => str($application->start_command)->trim(),
|
||||
'base_directory' => str($application->base_directory)->trim(),
|
||||
'publish_directory' => str($application->publish_directory)->trim(),
|
||||
]);
|
||||
});
|
||||
static::created(function ($application) {
|
||||
@@ -902,9 +902,9 @@ class Application extends BaseModel
|
||||
$type = null;
|
||||
$source = null;
|
||||
if (is_string($volume)) {
|
||||
$source = Str::of($volume)->before(':');
|
||||
$source = str($volume)->before(':');
|
||||
if ($source->startsWith('./') || $source->startsWith('/') || $source->startsWith('~')) {
|
||||
$type = Str::of('bind');
|
||||
$type = str('bind');
|
||||
}
|
||||
} elseif (is_array($volume)) {
|
||||
$type = data_get_str($volume, 'type');
|
||||
|
@@ -174,7 +174,7 @@ class EnvironmentVariable extends Model
|
||||
if (str($environment_variable)->startsWith('{{'.$type) && str($environment_variable)->endsWith('}}')) {
|
||||
$variable = Str::after($environment_variable, "{$type}.");
|
||||
$variable = Str::before($variable, '}}');
|
||||
$variable = Str::of($variable)->trim()->value;
|
||||
$variable = str($variable)->trim()->value;
|
||||
if (! collect(SHARED_VARIABLE_TYPES)->contains($type)) {
|
||||
return $variable;
|
||||
}
|
||||
@@ -220,7 +220,7 @@ class EnvironmentVariable extends Model
|
||||
protected function key(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
set: fn (string $value) => Str::of($value)->trim(),
|
||||
set: fn (string $value) => str($value)->trim(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -4,7 +4,6 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class LocalPersistentVolume extends Model
|
||||
{
|
||||
@@ -33,14 +32,14 @@ class LocalPersistentVolume extends Model
|
||||
protected function name(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
set: fn (string $value) => Str::of($value)->trim()->value,
|
||||
set: fn (string $value) => str($value)->trim()->value,
|
||||
);
|
||||
}
|
||||
|
||||
protected function mountPath(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
set: fn (string $value) => Str::of($value)->trim()->start('/')->value
|
||||
set: fn (string $value) => str($value)->trim()->start('/')->value
|
||||
);
|
||||
}
|
||||
|
||||
@@ -49,7 +48,7 @@ class LocalPersistentVolume extends Model
|
||||
return Attribute::make(
|
||||
set: function (?string $value) {
|
||||
if ($value) {
|
||||
return Str::of($value)->trim()->start('/')->value;
|
||||
return str($value)->trim()->start('/')->value;
|
||||
} else {
|
||||
return $value;
|
||||
}
|
||||
|
@@ -11,7 +11,6 @@ use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Process;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Stringable;
|
||||
use Spatie\SchemalessAttributes\Casts\SchemalessAttributes;
|
||||
use Spatie\SchemalessAttributes\SchemalessAttributesTrait;
|
||||
@@ -29,10 +28,10 @@ class Server extends BaseModel
|
||||
static::saving(function ($server) {
|
||||
$payload = [];
|
||||
if ($server->user) {
|
||||
$payload['user'] = Str::of($server->user)->trim();
|
||||
$payload['user'] = str($server->user)->trim();
|
||||
}
|
||||
if ($server->ip) {
|
||||
$payload['ip'] = Str::of($server->ip)->trim();
|
||||
$payload['ip'] = str($server->ip)->trim();
|
||||
}
|
||||
$server->forceFill($payload);
|
||||
});
|
||||
@@ -875,7 +874,7 @@ $schema://$host {
|
||||
$releaseLines = collect(explode("\n", $os_release));
|
||||
$collectedData = collect([]);
|
||||
foreach ($releaseLines as $line) {
|
||||
$item = Str::of($line)->trim();
|
||||
$item = str($line)->trim();
|
||||
$collectedData->put($item->before('=')->value(), $item->after('=')->lower()->replace('"', '')->value());
|
||||
}
|
||||
$ID = data_get($collectedData, 'ID');
|
||||
|
Reference in New Issue
Block a user