diff --git a/beike/Shop/Http/Controllers/ManufacturerController.php b/beike/Shop/Http/Controllers/ManufacturerController.php new file mode 100644 index 00000000..c71da2fb --- /dev/null +++ b/beike/Shop/Http/Controllers/ManufacturerController.php @@ -0,0 +1,33 @@ + CountryRepo::all(), + 'addresses' => AddressResource::collection($addresses), + ]; + + return view('account/address', $data); + } + + public function show(Request $request, Product $product) + { + $product = ProductRepo::getProductDetail($product); + + $data = [ + 'product' => (new ProductDetail($product))->jsonSerialize(), + ]; + + return view('product', $data); + } +} diff --git a/database/migrations/2022_07_27_123325_create_manufacturers.php b/database/migrations/2022_07_27_123325_create_manufacturers.php index 87a8b087..37db291a 100644 --- a/database/migrations/2022_07_27_123325_create_manufacturers.php +++ b/database/migrations/2022_07_27_123325_create_manufacturers.php @@ -22,6 +22,9 @@ class CreateManufacturers extends Migration $table->integer('status'); $table->timestamps(); }); + Schema::table('products', function (Blueprint $table) { + $table->unsignedInteger('manufacturer_id')->after('id')->index(); + }); } /** @@ -32,5 +35,8 @@ class CreateManufacturers extends Migration public function down() { Schema::dropIfExists('manufacturers'); + Schema::table('products', function (Blueprint $table) { + $table->dropColumn('manufacturer_id'); + }); } }