Edit File: ProductFactory.php
<?php namespace Database\Factories; use App\Models\Product; use Illuminate\Database\Eloquent\Factories\Factory; /** * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Product> */ class ProductFactory extends Factory { protected $model = Product::class; private static $increment = 0; public function definition() { Self::$increment++; $productType = rand(0, 1); return [ 'name' => ['en' => 'Product ' . Self::$increment, 'ar' => 'منتج ' . Self::$increment], 'description' => ['en' => 'Lorem Ipsum is simply dummy text ' . Self::$increment, 'ar' => 'هناك حقيقة مثبتة منذ زمن طويل وهي أن المحتوى المقروء لصفحة ما سيلهي القارئ عن التركيز ' . Self::$increment], 'price' => $productType ? rand(100, 1000) : null, 'category_id' => rand(15, 22), // classifications 'provider_id' => rand(1, 50), 'has_price' => rand(0, 1) , ]; } }
Back to File Manager