Boilerplate for Listing resource

This commit is contained in:
2025-11-05 02:18:59 -08:00
parent b20e2258b2
commit 8355d57fc4
9 changed files with 276 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
<?php
use App\Models\User;
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('listings', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->text('title')->nullable(false);
$table->text('description')->nullable(false);
$table->text('location')->nullable(false);
$table->decimal('price')->default(0.0);
$table->foreignIdFor(User::class)->nullable(false);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('listings');
}
};