Ich Ich, gros commit

This commit is contained in:
bglacial
2018-10-08 22:31:58 +02:00
parent ecded0947f
commit b11b2befd7
49 changed files with 37276 additions and 11977 deletions

View File

@ -19,6 +19,7 @@ class CreateUsersTable extends Migration
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->enum('role', ['user', 'admin'])->default('user');
$table->rememberToken();
$table->timestamps();
});

View File

@ -15,9 +15,15 @@ class CreateRacesTable extends Migration
{
Schema::create('races', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->dateTime('start_date');
$table->dateTime('end_date');
$table->dateTime('end_date')->nullable();
$table->integer('duration');
$table->integer('autonomie_kart_sec');
$table->integer('autonomie_kart_humide');
$table->integer('relay_default_duration');
$table->string('stand_duration');
$table->text('comment')->nullable();
$table->timestamps();
});
}

View File

@ -16,8 +16,8 @@ class CreateKartsTable extends Migration
Schema::create('karts', function (Blueprint $table) {
$table->increments('id');
$table->string('name')->unique();
$table->integer('race_id')->unsigned();
$table->foreign('race_id')->references('id')->on('races')->onDelete('no action');
$table->dateTime('updated_at');
$table->dateTime('created_at');
});
}

View File

@ -17,6 +17,7 @@ class CreatePilotsTable extends Migration
$table->increments('id');
$table->string('name');
$table->string('first_name');
$table->integer('ref_time');
$table->integer('kart_id')->unsigned();
$table->foreign('kart_id')->references('id')->on('karts')->onDelete('no action');
$table->timestamps();

View File

@ -11,6 +11,9 @@ class DatabaseSeeder extends Seeder
*/
public function run()
{
// $this->call(UsersTableSeeder::class);
$this->call(UsersTableSeeder::class);
$this->call(RaceTableSeeder::class);
$this->call(KartTableSeeder::class);
$this->call(PilotTableSeeder::class);
}
}

View File

@ -0,0 +1,23 @@
<?php
use Illuminate\Database\Seeder;
use App\Kart;
use Carbon\Carbon;
class KartTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Kart::create([
'name' => 'OCK-1'
]);
Kart::create([
'name' => 'OCK-2'
]);
}
}

View File

@ -0,0 +1,79 @@
<?php
use Illuminate\Database\Seeder;
use App\Pilot;
use Carbon\Carbon;
class PilotTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Pilot::create([
'name' => 'Nicolas',
'first_name' => 'RIAULT',
'ref_time' => 67,
'kart_id' => 1
]);
Pilot::create([
'name' => 'Maxime',
'first_name' => 'LEGER',
'ref_time' => 58,
'kart_id' => 1
]);
Pilot::create([
'name' => 'Julien',
'first_name' => 'ROGER',
'ref_time' => 63,
'kart_id' => 1
]);
Pilot::create([
'name' => 'Romain',
'first_name' => 'PICHONNEAU',
'ref_time' => 63,
'kart_id' => 1
]);
Pilot::create([
'name' => 'Olivier',
'first_name' => 'PIRON',
'ref_time' => 63,
'kart_id' => 1
]);
Pilot::create([
'name' => 'test',
'first_name' => '1',
'ref_time' => 67,
'kart_id' => 2
]);
Pilot::create([
'name' => 'test',
'first_name' => '2',
'ref_time' => 58,
'kart_id' => 2
]);
Pilot::create([
'name' => 'test',
'first_name' => '3',
'ref_time' => 63,
'kart_id' => 2
]);
Pilot::create([
'name' => 'Romain',
'first_name' => '4',
'ref_time' => 63,
'kart_id' => 2
]);
Pilot::create([
'name' => 'test',
'first_name' => '5',
'ref_time' => 63,
'kart_id' => 2
]);
}
}

View File

@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Seeder;
use App\Race;
use Carbon\Carbon;
class RaceTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Race::create([
'name' => 'Course 24h',
'start_date' => Carbon::now(),
'end_date' => Carbon::now(),
'duration' => 24,
'autonomie_kart_sec' => 120,
'autonomie_kart_humide' => 200,
'relay_default_duration' => 45,
'stand_duration' => '60',
'comment' => 'Top',
]);
}
}

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Seeder;
use App\User;
use Carbon\Carbon;
class UsersTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
User::create([
'name' => 'Dupont',
'email' => 'dupont@chezlui.fr',
'role' => 'admin',
'password' => bcrypt('admin'),
'email_verified_at' => Carbon::now(),
]);
User::create([
'name' => 'Martin',
'email' => 'martin@chezlui.fr',
'password' => bcrypt('user'),
'email_verified_at' => Carbon::now(),
]);
}
}