品牌管理
This commit is contained in:
parent
ef0d22ca93
commit
9f6ad09ef8
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace Beike\Shop\Http\Controllers;
|
||||
|
||||
use Beike\Models\Product;
|
||||
use Beike\Repositories\ProductRepo;
|
||||
use Beike\Shop\Http\Resources\ProductDetail;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ManufacturerController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$addresses = AddressRepo::listByCustomer(current_customer());
|
||||
$data = [
|
||||
'countries' => 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);
|
||||
}
|
||||
}
|
||||
|
|
@ -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');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue