added product seeder WIP: need picture and category

pull/44/head
A1Gard 3 months ago
parent e19a69215e
commit 03b4d64893

@ -16,8 +16,16 @@ class ProductFactory extends Factory
*/
public function definition(): array
{
$rand = rand(1,2);
$title = ($rand == 1?'mobile':'Tablet').' ' . $this->faker->unique()->firstNameFemale;
return [
//
'name' => $title,
'slug' => sluger($title),
'excerpt' => $this->faker->realText(150),
'user_id' => 1,
'category_id' => $rand,
'description' => $this->faker->realText(600),
];
}
}

@ -2,6 +2,7 @@
namespace Database\Seeders;
use App\Models\Product;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
@ -13,5 +14,6 @@ class ProductSeeder extends Seeder
public function run(): void
{
//
Product::factory()->count(31)->create();
}
}

Loading…
Cancel
Save