reupload
This commit is contained in:
41
app/Http/Controllers/Web/Brand/BrandController.php
Normal file
41
app/Http/Controllers/Web/Brand/BrandController.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user