feat: add TextWidget

add TextWidget CRUD api

add basic tests for API
This commit is contained in:
jon brookes 2026-01-08 16:22:47 +00:00
parent 13cfd2961f
commit c66645cbdd
18 changed files with 536 additions and 1 deletions

View file

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

View file

@ -0,0 +1,30 @@
<?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('text_widgets', function (Blueprint $table) {
$table->id();
$table->string('title');
$table->text('description')->nullable();
$table->mediumText('content')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('text_widgets');
}
};