Switch bio to be stored in database
This commit is contained in:
parent
f51a740858
commit
bdb69df52d
14 changed files with 219 additions and 38 deletions
23
database/factories/BioFactory.php
Normal file
23
database/factories/BioFactory.php
Normal 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,
|
||||
];
|
||||
}
|
||||
}
|
28
database/migrations/2023_04_11_115837_create_bios_table.php
Normal file
28
database/migrations/2023_04_11_115837_create_bios_table.php
Normal 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');
|
||||
}
|
||||
};
|
17
database/seeders/BioSeeder.php
Normal file
17
database/seeders/BioSeeder.php
Normal 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();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue