Game formats

- Created the formats tables/migrations
- Created the controller to retrieve the formats
This commit is contained in:
2020-10-31 19:20:53 +00:00
parent 49778dbbc8
commit 0691e5a107
13 changed files with 350 additions and 231 deletions

View File

@@ -2,6 +2,7 @@
/** @var \Illuminate\Database\Eloquent\Factory $factory */
use App\Model\Format;
use App\User;
use Faker\Generator as Faker;
@@ -22,3 +23,9 @@ $factory->define(User::class, function (Faker $faker) {
'email' => $faker->email,
];
});
$factory->define(Format::class, function (Faker $faker){
return [
'name' => $faker->name
];
});

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateFormatsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('formats', function (Blueprint $table) {
$table->id();
$table->string('name')->unique();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('formats');
}
}

View File

@@ -12,5 +12,8 @@ class DatabaseSeeder extends Seeder
public function run()
{
// $this->call('UsersTableSeeder');
$this->call([
FormatSeeder::class
]);
}
}

View File

@@ -0,0 +1,17 @@
<?php
use Illuminate\Database\Seeder;
class FormatSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
\App\Model\Format::create(['name' => 'Commander']);
\App\Model\Format::create(['name' => 'Brawl']);
}
}