Switch bio to be stored in database

This commit is contained in:
Jonny Barnes 2023-04-11 16:16:05 +01:00
parent f51a740858
commit bdb69df52d
Signed by: jonny
SSH key fingerprint: SHA256:CTuSlns5U7qlD9jqHvtnVmfYV3Zwl2Z7WnJ4/dqOaL8
14 changed files with 219 additions and 38 deletions

View file

@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Bio>
*/
class BioFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'content' => $this->faker->paragraph,
];
}
}

View file

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

View file

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