feat(products): add thumbnail paths
This commit is contained in:
parent
3b05a045ed
commit
76afd14ffd
4 changed files with 26 additions and 0 deletions
|
|
@ -29,6 +29,7 @@ class ProductFactory extends Factory
|
|||
'sku' => strtoupper(fake()->bothify('SKU-#####??')),
|
||||
'short_description' => fake()->optional()->sentence(),
|
||||
'description' => fake()->paragraphs(2, true),
|
||||
'thumbnail_path' => null,
|
||||
'price' => fake()->randomFloat(2, 10, 10000),
|
||||
'stock_quantity' => fake()->numberBetween(0, 5000),
|
||||
'active' => fake()->boolean(90),
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->string('thumbnail_path')->nullable()->after('description');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->dropColumn('thumbnail_path');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -7,6 +7,7 @@ use App\Models\Category;
|
|||
use App\Models\Product;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class ProductSeeder extends Seeder
|
||||
|
|
@ -531,6 +532,7 @@ class ProductSeeder extends Seeder
|
|||
'slug' => Str::slug($product['name'].'-'.$product['sku']),
|
||||
'short_description' => $product['short'],
|
||||
'description' => $product['description'],
|
||||
'thumbnail_path' => "products/thumbnails/{$product['sku']}.png",
|
||||
'price' => $product['price'],
|
||||
'stock_quantity' => $product['stock'],
|
||||
'active' => true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue