diff --git a/src/Models/Ban.php b/src/Models/Ban.php index 063e180..17e4ea0 100644 --- a/src/Models/Ban.php +++ b/src/Models/Ban.php @@ -30,7 +30,7 @@ class Ban extends Model protected function expiredAt(): Attribute { - return Attribute::make( + return new Attribute( set: fn (null|string|Carbon $value) => (! is_null($value) && ! $value instanceof Carbon) ? Carbon::parse($value) : $value, ); } diff --git a/tests/Unit/BlockByCountryMiddlewareTest.php b/tests/Unit/BlockByCountryMiddlewareTest.php index 9a7db7c..33cb479 100644 --- a/tests/Unit/BlockByCountryMiddlewareTest.php +++ b/tests/Unit/BlockByCountryMiddlewareTest.php @@ -4,12 +4,11 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Cache; -use Illuminate\Support\Facades\Log; use Mchev\Banhammer\Exceptions\BanhammerException; use Mchev\Banhammer\Middleware\BlockByCountry; use Mchev\Banhammer\Services\IpApiService; -use Mockery; use Mchev\Banhammer\Tests\TestCase; +use Mockery; class BlockByCountryMiddlewareTest extends TestCase {