Rework frontend
This commit is contained in:
@@ -4,22 +4,31 @@ namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Resources\DivisionResource;
|
||||
use App\Models\Division;
|
||||
use App\Services\App\Breadcrumb\BreadcrumbService;
|
||||
use App\Services\App\Seo\SeoPageProvider;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Inertia;
|
||||
|
||||
class ClientDivisionController extends Controller
|
||||
{
|
||||
public function __construct(readonly SeoPageProvider $seoPageProvider){}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$divisions = DivisionResource::collection(Division::query()->where('is_active', true)->get());
|
||||
return Inertia::render('Client/Divisions/Index', compact('divisions'));
|
||||
|
||||
$seo = $this->seoPageProvider->getSeoForCurrentPage();
|
||||
|
||||
return Inertia::render('Client/Divisions/Index', compact('divisions', 'seo'));
|
||||
}
|
||||
|
||||
public function show(string $slug)
|
||||
{
|
||||
$divisions = DivisionResource::collection(Division::query()->where('is_active', true)->get());
|
||||
$division = new DivisionResource(Division::with('workers.userDetail')->where('is_active', true)->where('slug', $slug)->firstOrFail());
|
||||
$seo = $division->seo ?? null;
|
||||
$division = new DivisionResource($divisionModel = Division::with(['workers.userDetail', 'seo'])->where('is_active', true)->where('slug', $slug)->firstOrFail());
|
||||
|
||||
$seo = $this->seoPageProvider->getSeoForModel($divisionModel);
|
||||
|
||||
return Inertia::render('Client/Divisions/Show', compact('divisions', 'division', 'seo'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user