Skip to main content

Football Live-Score Website with Laravel, Reverb and Filament

Live football scores app with Filament admin panel, Laravel Reverb for real-time updates, and Inertia.js + React frontend.

How to install

  • Clone the repository with git clone
  • Copy the .env.example file to .env and edit database credentials there
  • Run composer install
  • Run php artisan key:generate
  • Run php artisan storage:link
  • Run php artisan migrate --seed (it has some seeded data for your testing)
  • Run npm ci and npm run build
  • Run php artisan reverb:start
  • Launch the main URL /.
  • Launch the URL /admin. Log in with credentials [email protected] and password to manage games.
  • That's it.

How It Works

Managing Games in Filament

The admin panel uses a custom Filament page for managing today's games in real-time. The page allows incrementing/decrementing scores and updating the game period.

app/Filament/Pages/ManageTodayGames.php:

public function incrementScore(int $gameId, string $team): void
{
$game = Game::find($gameId);
 
if ($team === 'home') {
$game->increment('home_score');
} else {
$game->increment('away_score');
}
 
event(new GameUpdated($game->fresh()));
 
$this->loadGames();
 
Notification::make()
->success()
->title('Score updated')
->body("Score updated to {$game->home_score} - {$game->away_score}")
->send();
}

After updating the score, the GameUpdated event is fired with a fresh copy of the game. Using fresh() is important here because it retrieves the latest data from the database, ensuring that the event broadcasts the updated scores rather than stale data.

The same pattern is used for decrementing scores and updating the game period:

public function updatedPeriods($value, $gameId): void
{
Game::where('id', $gameId)->update(['current_period' => GamePeriod::from($value)]);
 
event(new GameUpdated(Game::find($gameId)));
 
$this->loadGames();
}

Want to Get Access to GitHub Repository?

Unlock the complete README, installation instructions, code walkthrough, and direct access to clone the repository. Join our premium membership to access all project examples.

Full Source Code
Clone and customize
Documentation
Complete setup guides
All Examples
18 premium projects
Become a Premium Member for $129/year or $29/month

Related Content

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.