Add Destination resource (T2.2)
Migration/model/factory for destinations (name, mm_name, region, description fields, geo coordinates, is_active, popular) plus its Filament resource.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Catalog\Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Modules\Catalog\Models\Destination;
|
||||
|
||||
/**
|
||||
* @extends Factory<Destination>
|
||||
*/
|
||||
class DestinationFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => fake()->city(),
|
||||
'mm_name' => fake()->city(),
|
||||
'region' => fake()->state(),
|
||||
'description' => fake()->sentence(),
|
||||
'mm_description' => null,
|
||||
'meta_keyword' => null,
|
||||
'meta_description' => null,
|
||||
'latitude' => fake()->latitude(),
|
||||
'longitude' => fake()->longitude(),
|
||||
'is_active' => true,
|
||||
'popular' => false,
|
||||
];
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
<?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('destinations', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('mm_name');
|
||||
$table->string('region')->nullable();
|
||||
$table->text('description')->nullable();
|
||||
$table->text('mm_description')->nullable();
|
||||
$table->text('meta_keyword')->nullable();
|
||||
$table->text('meta_description')->nullable();
|
||||
$table->string('latitude')->nullable();
|
||||
$table->string('longitude')->nullable();
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->boolean('popular')->default(false);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('destinations');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user