Skip to content

Commit

Permalink
Added matches, tournament, tournament matches seeds, added screenshot…
Browse files Browse the repository at this point in the history
…s to README.md
  • Loading branch information
kovalevcon committed Aug 22, 2019
1 parent 199bb3c commit 9344c87
Show file tree
Hide file tree
Showing 13 changed files with 451 additions and 47 deletions.
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,18 @@ The administrative section displays a report on commands with fields:
* “best performance per match”.

# Screenshots
TODO

Main page full:
![Main page full](public/images/sreenshots/main-page-all.png)

Main page tournament grid:
![Main page full](public/images/sreenshots/main-page-tournament-grid.png)

Admin panel - Tournament statistics:
![Main page full](public/images/sreenshots/admin-panel-tournament-stats.png)

Admin panel - Tournament matches:
![Main page full](public/images/sreenshots/admin-panel-tournament-matches.png)

# Install

Expand All @@ -33,10 +44,10 @@ TODO
```bash
php artisan admin:install
```
3. Execute migrations:
3. Refresh migrations (some problem with admin_menu inserting):

```bash
php artisan migrate
php artisan migrate:refresh --path=/database/migrations/2019_08_22_014400_create_playoff_admin_menu.php
```

4. **(Optional)** Complete seeds for example data (teams, matches, tournament, tournament matches):
Expand All @@ -45,6 +56,11 @@ TODO
php artisan db:seed
```

5. See main page on `http://localhost/`.

6. See admin panel on `http://localhost/admin`.
Login: `admin`, Password: `admin`.

Thanks `Joe Beason` for design ([link](https://codepen.io/jbeason/full/Wbaedb/)).

@kovalevcon
2 changes: 1 addition & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
|
*/

'timezone' => 'UTC',
'timezone' => 'Europe/Moscow',

/*
|--------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public function up(): void
$table->bigIncrements('id');
$table->unsignedBigInteger('tournament_id');
$table->unsignedBigInteger('match_id');
$table->unsignedBigInteger('top_match_id');
$table->unsignedBigInteger('bottom_match_id');
$table->unsignedBigInteger('top_match_id')->nullable();
$table->unsignedBigInteger('bottom_match_id')->nullable();
$table->unsignedTinyInteger('match_number');
$table->string('stage', 10);
$table->timestamps();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?php

declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

/**
* Class CreateAdminMenu
* Class CreatePlayoffAdminMenu
*/
class CreateAdminMenu extends Migration
class CreatePlayoffAdminMenu extends Migration
{
/**
* Run the migrations.
Expand All @@ -14,10 +15,10 @@ class CreateAdminMenu extends Migration
*/
public function up(): void
{
\Illuminate\Support\Facades\DB::table('admin_menu')->delete(1);
DB::table('admin_menu')->delete(1);

/** @var int $rootId */
$rootId = \Illuminate\Support\Facades\DB::table('admin_menu')->insertGetId(
$rootId = DB::table('admin_menu')->insertGetId(
[
'parent_id' => 0,
'order' => 1,
Expand All @@ -30,7 +31,7 @@ public function up(): void
]
);

\Illuminate\Support\Facades\DB::table('admin_menu')->insert([
DB::table('admin_menu')->insert([
[
'parent_id' => $rootId,
'order' => 2,
Expand Down
9 changes: 7 additions & 2 deletions database/seeds/DatabaseSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ class DatabaseSeeder extends Seeder
*
* @return void
*/
public function run()
public function run(): void
{
$this->call(TeamsTableSeeder::class);
$this->call([
TeamsTableSeeder::class,
MatchesTableSeeder::class,
TournamentsTableSeeder::class,
TournamentMatchesTableSeeder::class,
]);
}
}
167 changes: 167 additions & 0 deletions database/seeds/MatchesTableSeeder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
<?php
declare(strict_types=1);
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

/**
* Class MatchesTableSeeder
*/
class MatchesTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run(): void
{
/** @var \Carbon\Carbon $date */
$date = now();
DB::table('matches')->insert([
[
'id' => 1,
'top_team_id' => 1,
'bottom_team_id' => 2,
'top_team_score' => 2,
'bottom_team_score' => 1,
'created_at' => $date,
'updated_at' => $date,
],
[
'id' => 2,
'top_team_id' => 3,
'bottom_team_id' => 4,
'top_team_score' => 4,
'bottom_team_score' => 3,
'created_at' => $date,
'updated_at' => $date,
],
[
'id' => 3,
'top_team_id' => 5,
'bottom_team_id' => 6,
'top_team_score' => 2,
'bottom_team_score' => 0,
'created_at' => $date,
'updated_at' => $date,
],
[
'id' => 4,
'top_team_id' => 7,
'bottom_team_id' => 8,
'top_team_score' => 3,
'bottom_team_score' => 2,
'created_at' => $date,
'updated_at' => $date,
],
[
'id' => 5,
'top_team_id' => 9,
'bottom_team_id' => 10,
'top_team_score' => 2,
'bottom_team_score' => 1,
'created_at' => $date,
'updated_at' => $date,
],
[
'id' => 6,
'top_team_id' => 11,
'bottom_team_id' => 12,
'top_team_score' => 3,
'bottom_team_score' => 1,
'created_at' => $date,
'updated_at' => $date,
],
[
'id' => 7,
'top_team_id' => 13,
'bottom_team_id' => 14,
'top_team_score' => 1,
'bottom_team_score' => 0,
'created_at' => $date,
'updated_at' => $date,
],
[
'id' => 8,
'top_team_id' => 15,
'bottom_team_id' => 16,
'top_team_score' => 1,
'bottom_team_score' => 2,
'created_at' => $date,
'updated_at' => $date,
],
[
'id' => 9,
'top_team_id' => 1,
'bottom_team_id' => 3,
'top_team_score' => 0,
'bottom_team_score' => 2,
'created_at' => $date,
'updated_at' => $date,
],
[
'id' => 10,
'top_team_id' => 5,
'bottom_team_id' => 7,
'top_team_score' => 1,
'bottom_team_score' => 2,
'created_at' => $date,
'updated_at' => $date,
],
[
'id' => 11,
'top_team_id' => 10,
'bottom_team_id' => 11,
'top_team_score' => 2,
'bottom_team_score' => 3,
'created_at' => $date,
'updated_at' => $date,
],
[
'id' => 12,
'top_team_id' => 13,
'bottom_team_id' => 16,
'top_team_score' => 0,
'bottom_team_score' => 2,
'created_at' => $date,
'updated_at' => $date,
],
[
'id' => 13,
'top_team_id' => 3,
'bottom_team_id' => 7,
'top_team_score' => 1,
'bottom_team_score' => 0,
'created_at' => $date,
'updated_at' => $date,
],
[
'id' => 14,
'top_team_id' => 11,
'bottom_team_id' => 16,
'top_team_score' => 2,
'bottom_team_score' => 1,
'created_at' => $date,
'updated_at' => $date,
],
[
'id' => 15,
'top_team_id' => 7,
'bottom_team_id' => 16,
'top_team_score' => 2,
'bottom_team_score' => 1,
'created_at' => $date,
'updated_at' => $date,
],
[
'id' => 16,
'top_team_id' => 3,
'bottom_team_id' => 11,
'top_team_score' => 3,
'bottom_team_score' => 2,
'created_at' => $date,
'updated_at' => $date,
],
]);
}
}
Loading

0 comments on commit 9344c87

Please sign in to comment.