wip
This commit is contained in:
48
app/Http/Controllers/Web/Seller/EntrepreneurController.php
Normal file
48
app/Http/Controllers/Web/Seller/EntrepreneurController.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Web\Seller;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Ecommerce\Channel\Channel;
|
||||
use App\Repositories\Ecommerce\Product\ProductRepository;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class EntrepreneurController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('web.themes.shella.pages.entrepreneurs.home.index', [
|
||||
'channels' => Channel::where('is_visible', true)->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Request $request, $entrepreneur)
|
||||
{
|
||||
$channel = Channel::where('slug', $entrepreneur)->where('is_visible', true)->firstOrFail();
|
||||
|
||||
$products = ProductRepository::make($request)
|
||||
->queryAsFromResource($channel)
|
||||
->applyBasicQueries()
|
||||
->applyFilters()
|
||||
->applySorting()
|
||||
->simplePaginate();
|
||||
|
||||
return $request->ajax()
|
||||
? ProductRepository::ajaxPaginate($products)
|
||||
: view('web.themes.shella.pages.entrepreneurs.home.products', [
|
||||
'resource' => $channel,
|
||||
'products' => $products,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user