Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ludoguenet committed Mar 3, 2024
1 parent cc0a568 commit 5bca49e
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 43 deletions.
55 changes: 55 additions & 0 deletions app/Actions/Nudge/GenerateRandomSynonym.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

declare(strict_types=1);

namespace App\Actions\Nudge;

class GenerateRandomSynonym
{
public function handle(): string
{
$synonyms = collect([
'awesome',
'amazing',
'incredible',
'fantastic',
'phenomenal',
'stellar',
'superb',
'excellent',
'outstanding',
'marvelous',
'splendid',
'wonderful',
'brilliant',
'awe-inspiring',
'dope',
'rad',
'majestic',
'legendary',
'top-notch',
'formidable',
'breathtaking',
'stunning',
'sublime',
'astonishing',
'surprising',
'staggering',
'sensational',
'exceptional',
'grandiose',
'eloquent',
'epic',
'impeccable',
'radiant',
'moving',
'fabulous',
'divine',
'mind-blowing',
'splendiferous',
'out of this world',
]);

return $synonyms->random();
}
}
45 changes: 2 additions & 43 deletions app/Http/Controllers/HomePageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,15 @@

namespace App\Http\Controllers;

use App\Actions\Nudge\GenerateRandomSynonym;
use App\Models\Nudge;
use Illuminate\View\View;

class HomePageController extends Controller
{
public function __invoke(): View
{
$synonyms = collect([
'awesome',
'amazing',
'incredible',
'fantastic',
'phenomenal',
'stellar',
'superb',
'excellent',
'outstanding',
'marvelous',
'splendid',
'wonderful',
'brilliant',
'awe-inspiring',
'dope',
'rad',
'majestic',
'legendary',
'top-notch',
'formidable',
'breathtaking',
'stunning',
'sublime',
'astonishing',
'surprising',
'staggering',
'sensational',
'exceptional',
'grandiose',
'eloquent',
'epic',
'impeccable',
'radiant',
'moving',
'fabulous',
'divine',
'mind-blowing',
'splendiferous',
'out of this world',
]);

$randomSynonym = $synonyms->random();
$randomSynonym = (new GenerateRandomSynonym)->handle();

$randomNudge = Nudge::query()
->withCount('likes')
Expand Down

0 comments on commit 5bca49e

Please sign in to comment.