migrate template
This commit is contained in:
31
database/factories/CategoryFactory.php
Normal file
31
database/factories/CategoryFactory.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Category;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends Factory<Category>
|
||||
*/
|
||||
class CategoryFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
$name = fake()->unique()->word();
|
||||
|
||||
return [
|
||||
'name' => $name,
|
||||
'slug' => Str::slug($name),
|
||||
'icon' => 'category',
|
||||
'sort_order' => fake()->numberBetween(0, 10),
|
||||
'is_active' => true,
|
||||
];
|
||||
}
|
||||
|
||||
public function inactive(): static
|
||||
{
|
||||
return $this->state(['is_active' => false]);
|
||||
}
|
||||
}
|
||||
21
database/factories/FooterNavLinkFactory.php
Normal file
21
database/factories/FooterNavLinkFactory.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\FooterNavLink;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<FooterNavLink>
|
||||
*/
|
||||
class FooterNavLinkFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'label' => fake()->word(),
|
||||
'url' => '#',
|
||||
'sort_order' => fake()->numberBetween(0, 10),
|
||||
];
|
||||
}
|
||||
}
|
||||
30
database/factories/HeroSlideFactory.php
Normal file
30
database/factories/HeroSlideFactory.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\HeroSlide;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<HeroSlide>
|
||||
*/
|
||||
class HeroSlideFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'headline' => fake()->sentence(3),
|
||||
'subheadline' => fake()->sentence(8),
|
||||
'cta_label' => fake()->words(3, true),
|
||||
'cta_url' => '#',
|
||||
'image' => null,
|
||||
'sort_order' => fake()->numberBetween(0, 10),
|
||||
'is_active' => true,
|
||||
];
|
||||
}
|
||||
|
||||
public function inactive(): static
|
||||
{
|
||||
return $this->state(['is_active' => false]);
|
||||
}
|
||||
}
|
||||
42
database/factories/ProductFactory.php
Normal file
42
database/factories/ProductFactory.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Category;
|
||||
use App\Models\Product;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends Factory<Product>
|
||||
*/
|
||||
class ProductFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
$name = fake()->words(3, true);
|
||||
|
||||
return [
|
||||
'category_id' => Category::factory(),
|
||||
'name' => $name,
|
||||
'slug' => Str::slug($name),
|
||||
'price' => fake()->randomFloat(2, 10, 500),
|
||||
'price_unit' => fake()->randomElement(['kg', 'sany', 'gram']),
|
||||
'description' => fake()->sentence(12),
|
||||
'image' => null,
|
||||
'availability_status' => 'available',
|
||||
'is_active' => true,
|
||||
'sort_order' => fake()->numberBetween(0, 10),
|
||||
];
|
||||
}
|
||||
|
||||
public function unavailable(): static
|
||||
{
|
||||
return $this->state(['availability_status' => 'out_of_season']);
|
||||
}
|
||||
|
||||
public function inactive(): static
|
||||
{
|
||||
return $this->state(['is_active' => false]);
|
||||
}
|
||||
}
|
||||
30
database/factories/SignatureItemFactory.php
Normal file
30
database/factories/SignatureItemFactory.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\SignatureItem;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<SignatureItem>
|
||||
*/
|
||||
class SignatureItemFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => fake()->words(3, true),
|
||||
'price' => fake()->randomFloat(2, 50, 1000),
|
||||
'price_unit' => 'kg',
|
||||
'description' => fake()->sentence(12),
|
||||
'image' => null,
|
||||
'sort_order' => fake()->numberBetween(0, 10),
|
||||
'is_active' => true,
|
||||
];
|
||||
}
|
||||
|
||||
public function inactive(): static
|
||||
{
|
||||
return $this->state(['is_active' => false]);
|
||||
}
|
||||
}
|
||||
20
database/factories/SiteSettingFactory.php
Normal file
20
database/factories/SiteSettingFactory.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\SiteSetting;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<SiteSetting>
|
||||
*/
|
||||
class SiteSettingFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'key' => fake()->unique()->slug(),
|
||||
'value' => fake()->sentence(),
|
||||
];
|
||||
}
|
||||
}
|
||||
22
database/factories/SocialLinkFactory.php
Normal file
22
database/factories/SocialLinkFactory.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\SocialLink;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<SocialLink>
|
||||
*/
|
||||
class SocialLinkFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'platform' => fake()->randomElement(['Instagram', 'Facebook', 'Email', 'Telegram']),
|
||||
'url' => fake()->url(),
|
||||
'icon' => 'link',
|
||||
'sort_order' => fake()->numberBetween(0, 10),
|
||||
];
|
||||
}
|
||||
}
|
||||
23
database/factories/TimelineEntryFactory.php
Normal file
23
database/factories/TimelineEntryFactory.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\TimelineEntry;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<TimelineEntry>
|
||||
*/
|
||||
class TimelineEntryFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'year' => fake()->year(),
|
||||
'title' => fake()->sentence(3),
|
||||
'body' => fake()->paragraph(),
|
||||
'icon' => 'history',
|
||||
'sort_order' => fake()->numberBetween(0, 10),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user