Skip to content

Commit

Permalink
fix: linting
Browse files Browse the repository at this point in the history
  • Loading branch information
pushpak1300 committed Jan 19, 2025
1 parent f987b75 commit 92dabed
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
9 changes: 5 additions & 4 deletions app/Http/Controllers/User/LoginLinkController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use App\Models\User;
use App\Models\LoginLink;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
Expand All @@ -19,9 +18,11 @@

final class LoginLinkController extends Controller
{
private const RATE_LIMIT_PREFIX = 'login-link:';
private const RATE_LIMIT_ATTEMPTS = 1;
private const EXPIRATION_TIME = 15;
private const string RATE_LIMIT_PREFIX = 'login-link:';

private const int RATE_LIMIT_ATTEMPTS = 1;

private const int EXPIRATION_TIME = 15;

/**
* Create a new magic link.
Expand Down
2 changes: 0 additions & 2 deletions app/Models/LoginLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ public function user(): BelongsTo
/**
* Get the prunable model query.
* This will delete all magic links that were created more than a week ago.
*
* @return Builder
*/
public function prunable(): Builder
{
Expand Down
9 changes: 3 additions & 6 deletions tests/Feature/Controllers/User/LoginLinkControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,19 @@
use App\Models\User;
use App\Models\LoginLink;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\URL;
use App\Notifications\LoginLinkMail;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Notification;
use App\Http\Controllers\User\LoginLinkController;
use Illuminate\Routing\Middleware\ThrottleRequests;

use function Pest\Laravel\assertAuthenticatedAs;
use function Pest\Laravel\get;
use function Pest\Laravel\post;
use function Pest\Laravel\assertGuest;
use function Pest\Laravel\assertDatabaseHas;
use function Pest\Laravel\withoutMiddleware;
use function Pest\Laravel\assertDatabaseCount;
use function Pest\Laravel\assertGuest;
use function Pest\Laravel\assertAuthenticatedAs;

covers(LoginLinkController::class);

Expand Down Expand Up @@ -87,9 +86,7 @@
it('authenticates user with valid token', function (): void {
$user = User::factory()->create();

Str::createRandomStringsUsing(function () {
return 'fake-random-string';
});
Str::createRandomStringsUsing(fn(): string => 'fake-random-string');
post(route('login-link.store'), [
'email' => $user->email,
]);
Expand Down

0 comments on commit 92dabed

Please sign in to comment.