Skip to content

Commit

Permalink
Fix str() which returns a new Illuminate\Support\Stringable instance
Browse files Browse the repository at this point in the history
They should returns an instance of `Illuminate\Support\Str`
  • Loading branch information
realodix committed Jun 10, 2024
1 parent cd7019b commit 0e234ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion app/Models/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use App\Services\KeyGeneratorService;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;

/**
* @property int $id
Expand Down Expand Up @@ -118,7 +119,7 @@ protected function title(): Attribute
set: function ($value) {
if (mb_strlen($value) > self::TITLE_LENGTH) {
// $limit minus 3 because Str::limit() adds 3 extra characters.
return str($value)->limit(self::TITLE_LENGTH - 3, '...');
return Str::limit($value, self::TITLE_LENGTH - 3, '...');
}

return $value;
Expand Down
8 changes: 4 additions & 4 deletions resources/views/backend/about.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@
$redirectCacheMaxAge = config('urlhub.redirect_cache_max_age');
@endphp
<dt><code>keyword_length</code></dt>
<dd>{{ $hashLength.' '.str('character')->plural($hashLength) }}</dd>
<dd>{{ $hashLength.' '.str()->plural('character', $hashLength) }}</dd>

<dt><code>custom_keyword_min_length</code></dt>
<dd>{{ $customKeywordMinLength.' '.str('character')->plural($customKeywordMinLength) }}</dd>
<dd>{{ $customKeywordMinLength.' '.str()->plural('character', $customKeywordMinLength) }}</dd>

<dt><code>custom_keyword_max_length</code></dt>
<dd>{{ $customKeywordMaxLength.' '.str('character')->plural($customKeywordMaxLength) }}</dd>
<dd>{{ $customKeywordMaxLength.' '.str()->plural('character', $customKeywordMaxLength) }}</dd>

@php
$domainBlacklist = collect(config('urlhub.domain_blacklist'))
Expand Down Expand Up @@ -149,7 +149,7 @@
<dd>{{ config('urlhub.redirect_status_code') }}</dd>

<dt><code>redirect_cache_max_age</code></dt>
<dd>{{ $redirectCacheMaxAge.' '.str('second')->plural($redirectCacheMaxAge) }}</dd>
<dd>{{ $redirectCacheMaxAge.' '.str()->plural('second', $redirectCacheMaxAge) }}</dd>

<dt><code>track_bot_visits</code></dt>
<dd>
Expand Down

0 comments on commit 0e234ec

Please sign in to comment.