seeder_Email_activation

このコミットが含まれているのは:
山崎満 2021-08-13 13:17:12 +09:00
コミット 67efdcc49d
8個のファイルの変更115行の追加5行の削除

11
backend/app/Models/EmailActivation.php ノーマルファイル
ファイルの表示

@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class EmailActivation extends Model
{
use HasFactory;
}

11
backend/app/Models/child.php ノーマルファイル
ファイルの表示

@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class child extends Model
{
use HasFactory;
}

ファイルの表示

@ -22,7 +22,6 @@ class AdminFactory extends Factory
public function definition()
{
return [
// 'id' => $this->faker->numberBetween,
'email' => $this->faker->email,
'password' => $this->faker->password,
'remember_token' => $this->faker->password,

ファイルの表示

@ -0,0 +1,33 @@
<?php
namespace Database\Factories;
use App\Models\EmailActivation;
use Illuminate\Database\Eloquent\Factories\Factory;
class EmailActivationFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = EmailActivation::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'father_id' => 1,
'email' => $this->faker->email,
'token' => $this->faker->randomNumber(8),
'ttl' => $this->faker->dateTime,
'created_at' => $this->faker->dateTime,
'updated_at' => $this->faker->dateTime,
];
}
}

ファイルの表示

@ -22,7 +22,6 @@ class FatherFactory extends Factory
public function definition()
{
return [
// 'id' => $this->faker->numberBetween,
'email' => $this->faker->email,
'email_verified_at' => $this->faker->dateTime,
'password' => $this->faker->password,

ファイルの表示

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateEmailActivationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('email_activations', function (Blueprint $table) {
$table->bigIncrements('id');
$table->integer('father_id');
$table->string('email');
$table->string('token');
$table->timestamps('ttl');
$table->timestamps('created_at');
$table->timestamps('updated_at');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('email_activations');
}
}

ファイルの表示

@ -13,9 +13,11 @@ class DatabaseSeeder extends Seeder
*/
public function run()
{
// $this->call
// (AdminsTableSeeder::class);
// $this->call
// (FathersTableSeeder::class);
$this->call
(AdminsTableSeeder::class);
$this->call
(FathersTableSeeder::class);
(EmailActivationsTableSeeder::class);
}
}

ファイルの表示

@ -0,0 +1,19 @@
<?php
namespace Database\Seeders;
use App\Models\EmailActivations;
use Illuminate\Database\Seeder;
class EmailActivationsTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
\App\Models\EmailActivation::factory()->count(10)->create();
}
}