- add deal category migration - add deals migration and model - add form to create deal - add image preview modal when uploading the image - refactor UI components to support `required` attribute - refactor input component to support description - fix some UI components does not support old values - fix some UI components does not show error messages
38 lines
945 B
PHP
38 lines
945 B
PHP
<?php
|
|
|
|
use App\Models\DealCategory;
|
|
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('deals', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->string('title');
|
|
$table->string('slug');
|
|
$table->text('description');
|
|
$table->string('image')->nullable();
|
|
$table->string('link')->nullable();
|
|
$table->boolean('active')->default(false);
|
|
$table->foreignIdFor(DealCategory::class);
|
|
$table->foreignIdFor(User::class);
|
|
$table->timestamps();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('deals');
|
|
}
|
|
};
|