seed9つ
このコミットが含まれているのは:
コミット
eb0c81cc58
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Meeting extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class MeetingChild extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class MeetingImage extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\MeetingChild;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class MeetingChildFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = MeetingChild::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'child_id'=>1,
|
||||
'meeting_id'=>1,
|
||||
'approval_at'=>$this->faker->dateTime,
|
||||
'created_at'=>$this->faker->dateTime,
|
||||
'updated_at'=>$this->faker->dateTime,
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Meeting;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class MeetingFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Meeting::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'father_id'=>1,
|
||||
'title'=>$this->faker->name,
|
||||
'text'=>$this->faker->realText(49),
|
||||
'pdf'=>$this->faker->url,
|
||||
'is_favorite'=>$this->faker->numberBetween($min=0, $max=1),
|
||||
'created_at' => $this->faker->dateTime,
|
||||
'updated_at' => $this->faker->dateTime,
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\MeetingImage;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class MeetingImageFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = MeetingImage::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'meeting_id'=>1,
|
||||
'image'=>$this->faker->url,
|
||||
'created_at' => $this->faker->dateTime,
|
||||
'updated_at' => $this->faker->dateTime,
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateMeetingsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('meetings', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->foreign('father_id');
|
||||
$table->string('title');
|
||||
$table->string('text');
|
||||
$table->string('pdf');
|
||||
$table->integer('is_favorite');
|
||||
$table->timestamps('created_at');
|
||||
$table->timestamps('updated_at');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('meetings');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateMeetingImagesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('meeting_images', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->foreign('meeting_id');
|
||||
$table->string('image');
|
||||
$table->timestamps('created_at');
|
||||
$table->timestamps('updated_at');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('meeting_images');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateMeetingChildrenTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('meeting_children', function (Blueprint $table) {
|
||||
$table->bigIncrement('id');
|
||||
$table->foreign('child_id');
|
||||
$table->foreign('meeting_id');
|
||||
$table->timestamps('approval_at');
|
||||
$table->timestamps('created_at');
|
||||
$table->timestamps('updated_at');
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('meeting_children');
|
||||
}
|
||||
}
|
|
@ -23,7 +23,13 @@ class DatabaseSeeder extends Seeder
|
|||
// (ChildrenTableSeeder::class);
|
||||
// $this->call
|
||||
// (TelActivationsTableSeeder::class);
|
||||
// $this->call
|
||||
// (FatherRelationsTableSeeder::class);
|
||||
// $this->call
|
||||
// (MeetingsTableSeeder::class);
|
||||
// $this->call
|
||||
// (MeetingImagesTableSeeder::class);
|
||||
$this->call
|
||||
(FatherRelationsTableSeeder::class);
|
||||
(MeetingChildrenTableSeeder::class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Models\MeetingChild;
|
||||
|
||||
class MeetingChildrenTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
\App\Models\MeetingChild::factory()->count(10)->create();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Models\MeetingImage;
|
||||
|
||||
class MeetingImagesTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
\App\Models\MeetingImage::factory()->count(10)->create();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
use App\Models\Meeting;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class MeetingsTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
\App\Models\Meeting::factory()->count(10)->create();
|
||||
}
|
||||
}
|
新しいイシューから参照