このコミットが含まれているのは:
山崎満 2021-08-12 15:56:52 +09:00
コミット 3a7962e519
8個のファイルの変更113行の追加39行の削除

ファイルの表示

@ -8,4 +8,4 @@ use Illuminate\Database\Eloquent\Model;
class Admin extends Model
{
use HasFactory;
}
}

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

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

ファイルの表示

@ -5,41 +5,6 @@ namespace Database\Factories;
use \App\Models\Admin;
use Illuminate\Database\Eloquent\Factories\Factory;
// class AdminFactory extends Factory
// {
// /**
// * The name of the factory's corresponding model.
// *
// * @var string
// */
// protected $model = Model::class;
// /**
// * Define the model's default state.
// *
// * @return array
// */
// public function definition()
// {
// return [
// //
// ];
// }
// }
// use Faker\Generator as Faker;
// $factory->define(Admin::class, function (Faker $faker){
// return[
// 'id' => $this->faker->name,
// 'email' => $this->faker->name,
// 'password' => $this->faker->name,
// 'remember_token' => $this->faker->name,
// 'created_at' => $this->faker->name,
// 'updated_at' => $this->faker->name,
// ];
// });
class AdminFactory extends Factory
{
/**
@ -57,7 +22,7 @@ class AdminFactory extends Factory
public function definition()
{
return [
'id' => $this->faker->numberBetween,
// 'id' => $this->faker->numberBetween,
'email' => $this->faker->email,
'password' => $this->faker->password,
'remember_token' => $this->faker->password,

38
backend/database/factories/FatherFactory.php ノーマルファイル
ファイルの表示

@ -0,0 +1,38 @@
<?php
namespace Database\Factories;
use App\Models\Father;
use Illuminate\Database\Eloquent\Factories\Factory;
class FatherFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Father::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
// 'id' => $this->faker->numberBetween,
'email' => $this->faker->email,
'email_verified_at' => $this->faker->dateTime,
'password' => $this->faker->password,
'last_name' => $this->faker->lastName,
'first_name' => $this->faker->firstName,
'image' => $this->faker->imageUrl,
'profile' => $this->faker->realText(49),
'remember_token' => $this->faker->dateTime,
'created_at' => $this->faker->dateTime,
'updated_at' => $this->faker->dateTime,
];
}
}

ファイルの表示

@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateFathersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('fathers', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('email');
$table->string('email_verified_at');
$table->string('password');
$table->string('last_name');
$table->string('first_name');
$table->string('image');
$table->string('profile');
$table->string('remember_token');
$table->timestamps('created_at');
$table->timestamps('updated_at');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('fathers');
}
}

ファイルの表示

@ -14,6 +14,6 @@ class AdminsTableSeeder extends Seeder
*/
public function run()
{
\App\Models\Admin::factory()->count(10)->create();
\App\Models\Admin::factory()->count(10)->create();
}
}

ファイルの表示

@ -13,8 +13,9 @@ class DatabaseSeeder extends Seeder
*/
public function run()
{
// \App\Models\User::factory(10)->create();
$this->call
(AdminsTableSeeder::class);
$this->call
(FathersTableSeeder::class);
}
}

ファイルの表示

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