59 lines
1.5 KiB
PHP
59 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Bo;
|
|
|
|
use App\Enums\Pagination\ItemsPerPaginationEnum;
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\ArcadiaBrand;
|
|
use Illuminate\Http\Request;
|
|
|
|
class BrandController extends Controller
|
|
{
|
|
/**
|
|
* Create the controller instance.
|
|
*/
|
|
public function __construct()
|
|
{
|
|
$this->authorizeResource(ArcadiaBrand::class);
|
|
}
|
|
|
|
/**
|
|
* Display a listing of the resource.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function index(Request $request)
|
|
{
|
|
/** @var \Illuminate\Database\Eloquent\Builder $query */
|
|
$query = ArcadiaBrand::query();
|
|
|
|
if ($request->search) {
|
|
$this->searchQuery(
|
|
$query,
|
|
$request->search,
|
|
null,
|
|
'id',
|
|
'label',
|
|
);
|
|
}
|
|
|
|
$this->sortQuery($query);
|
|
$searchFields = trans('Arcadia id, Label');
|
|
|
|
$brandModels = $this->paginate($query, ItemsPerPaginationEnum::twentyfive);
|
|
|
|
return view('bo.pages.brands.index', compact('brandModels', 'searchFields'));
|
|
}
|
|
|
|
/**
|
|
* Display the specified resource.
|
|
*
|
|
* @param \App\Models\ArcadiaBrand $arcadiaBrand
|
|
* @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory
|
|
*/
|
|
public function show(ArcadiaBrand $arcadiaBrand)
|
|
{
|
|
return view('bo.pages.brands.show', ['brandModel' => $arcadiaBrand]);
|
|
}
|
|
}
|