42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Web\Brand;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Ecommerce\Product\Brand\Brand;
|
|
use App\Repositories\Ecommerce\Product\ProductRepository;
|
|
use Illuminate\Http\Request;
|
|
|
|
class BrandController extends Controller
|
|
{
|
|
/**
|
|
* Display the specified resource.
|
|
*
|
|
* @return Application|Factory|View
|
|
*/
|
|
public function show(Brand $brand)
|
|
{
|
|
return to_route('web.brands.products', ['brand' => $brand->slug]);
|
|
}
|
|
|
|
/**
|
|
* Brand products
|
|
*/
|
|
public function products(Brand $brand, Request $request)
|
|
{
|
|
$products = ProductRepository::make($request)
|
|
->queryAsFromResource($brand)
|
|
->applyBasicQueries()
|
|
->applyFilters()
|
|
->applySorting()
|
|
->simplePaginate();
|
|
|
|
return $request->ajax()
|
|
? ProductRepository::ajaxPaginate($products)
|
|
: view('web.themes.shella.pages.brands.products.index', [
|
|
'brand' => $brand,
|
|
'products' => $products,
|
|
]);
|
|
}
|
|
}
|