products now have an image
This commit is contained in:
@@ -21,6 +21,7 @@ class ProductFactory extends Factory
|
||||
'name' => $this->faker->words(3, true),
|
||||
'description' => $this->faker->sentence(12),
|
||||
'price_cents' => $this->faker->numberBetween(499, 9999),
|
||||
'image_url' => null,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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::table('products', function (Blueprint $table) {
|
||||
$table->string('image_url')->nullable()->after('description');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->dropColumn('image_url');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -16,29 +16,32 @@ class DatabaseSeeder extends Seeder
|
||||
{
|
||||
// User::factory(10)->create();
|
||||
|
||||
//User::factory()->create([
|
||||
// 'name' => 'Test User',
|
||||
// 'email' => 'test@example.com',
|
||||
//]);
|
||||
User::factory()->create([
|
||||
'name' => 'Test User',
|
||||
'email' => 'test@example.com',
|
||||
]);
|
||||
|
||||
Product::create([
|
||||
'name' => 'Ant Spray',
|
||||
'description' => '',
|
||||
'price' => 10000,
|
||||
'name' => 'Ant Deterrant',
|
||||
'description' => 'A common problem we can easily take care of!',
|
||||
'price_cents' => 10000,
|
||||
'image_url' => 'https://shopping-cart.test/storage/products/ant.jpg'
|
||||
]);
|
||||
|
||||
|
||||
Product::create([
|
||||
'name' => 'Spider Spray',
|
||||
'description' => '',
|
||||
'price' => 25000,
|
||||
'name' => 'Spider Removal',
|
||||
'description' => 'More aggressive that just removing the little ones.',
|
||||
'price_cents' => 25000,
|
||||
'image_url' => 'https://shopping-cart.test/storage/products/spider.jpg'
|
||||
]);
|
||||
|
||||
|
||||
Product::create([
|
||||
'name' => 'Infestation Spray',
|
||||
'description' => '',
|
||||
'price' => 50000,
|
||||
'name' => 'Infestation Mitigation',
|
||||
'description' => 'Time to call in DOOM guy.',
|
||||
'price_cents' => 50000,
|
||||
'image_url' => 'https://shopping-cart.test/storage/products/hydralisk.webp'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user