Changes
This commit is contained in:
@@ -134,6 +134,8 @@ class ClientAdditionalEducationController extends Controller
|
||||
$breadcrumbs = null;
|
||||
}
|
||||
|
||||
return Inertia::render('Client/Additional-educations/Show', compact('additionalEducation', 'breadcrumbs'));
|
||||
$seo = $additionalEducation->seo;
|
||||
|
||||
return Inertia::render('Client/Additional-educations/Show', compact('additionalEducation', 'breadcrumbs', 'seo'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,9 @@ class ClientDepartmentController extends Controller
|
||||
->with(['faculty', 'workers.userDetail', 'teachers.userDetail', 'programs.directionStudy'])
|
||||
->first());
|
||||
$directions = $this->groupProgramsByDirection($department->programs);
|
||||
return Inertia::render('Client/Departments/Show', compact('department', 'departments', 'directions'));
|
||||
|
||||
$seo = $department->seo;
|
||||
return Inertia::render('Client/Departments/Show', compact('department', 'departments', 'directions', 'seo'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ class ClientDivisionController extends Controller
|
||||
{
|
||||
$divisions = DivisionResource::collection(Division::query()->where('is_active', true)->get());
|
||||
$division = new DivisionResource(Division::with('workers.userDetail')->where('is_active', true)->where('slug', $slug)->first());
|
||||
return Inertia::render('Client/Divisions/Show', compact('divisions', 'division'));
|
||||
$seo = $division->seo;
|
||||
return Inertia::render('Client/Divisions/Show', compact('divisions', 'division', 'seo'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,10 +16,12 @@ class ClientFacultyController extends Controller
|
||||
return Inertia::render('Client/Faculties/Index', compact('faculties'));
|
||||
}
|
||||
|
||||
|
||||
public function show(string $slug)
|
||||
{
|
||||
$faculties = FacultyResource::collection(Faculty::query()->where('is_active', true)->get());
|
||||
$faculty = new FullFacultyResource(Faculty::where('slug', $slug)->where('is_active', true)->with(['departments.faculty', 'workers.userDetail'])->first());
|
||||
return Inertia::render('Client/Faculties/Show', compact('faculty', 'faculties'));
|
||||
$seo = $faculty->seo;
|
||||
return Inertia::render('Client/Faculties/Show', compact('faculty', 'faculties', 'seo'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +119,9 @@ class ClientProgramController extends Controller
|
||||
$formsEdu = $formsEducational->mapWithKeys(function ($formEducational) {
|
||||
return [$formEducational->value => $formEducational->getLabel()];
|
||||
});
|
||||
return Inertia::render('Client/Programs/Show', compact('program', 'formsEdu'));
|
||||
|
||||
$seo = $this->seo;
|
||||
return Inertia::render('Client/Programs/Show', compact('program', 'formsEdu', 'seo'));
|
||||
}
|
||||
|
||||
private function getAdmissionCampaignName() : string
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Enums\PostStatus;
|
||||
use App\Models\Page;
|
||||
use App\Models\Post;
|
||||
use Spatie\Sitemap\Sitemap;
|
||||
use Spatie\Sitemap\Tags\Url;
|
||||
|
||||
class GenerateSitemapController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$sitemap = Sitemap::create();
|
||||
|
||||
$this->generatePages($sitemap);
|
||||
$this->generatePosts($sitemap);
|
||||
|
||||
$sitemap->writeToFile(public_path('sitemap.xml'));
|
||||
}
|
||||
|
||||
protected function generatePages(Sitemap $sitemap)
|
||||
{
|
||||
$pages = Page::query()
|
||||
->where('is_visible', true)
|
||||
->where('code', 200)
|
||||
->get();
|
||||
|
||||
$this->addUrlsToSitemap($sitemap, $pages, function($page) {
|
||||
return [
|
||||
'path' => "/{$page->path}",
|
||||
'lastModificationDate' => $page->updated_at,
|
||||
'priority' => 0.5,
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
protected function generatePosts(Sitemap $sitemap)
|
||||
{
|
||||
$posts = Post::query()
|
||||
->where('status', PostStatus::PUBLISHED)
|
||||
->get();
|
||||
|
||||
$this->addUrlsToSitemap($sitemap, $posts, function($post) {
|
||||
return [
|
||||
'path' => "/news/{$post->slug}",
|
||||
'lastModificationDate' => $post->updated_at,
|
||||
'priority' => 0.5,
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
protected function addUrlsToSitemap(Sitemap $sitemap, $items, callable $callback)
|
||||
{
|
||||
foreach ($items as $item) {
|
||||
$urlData = $callback($item);
|
||||
$sitemap->add(Url::create($urlData['path'])
|
||||
->setLastModificationDate($urlData['lastModificationDate'])
|
||||
->setPriority($urlData['priority']));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,8 +14,10 @@ use App\Models\AdditionalEducation;
|
||||
use App\Models\EducationalGroup;
|
||||
use App\Models\EducationalProgram;
|
||||
use App\Models\Event;
|
||||
use App\Models\Faculty;
|
||||
use App\Models\Page;
|
||||
use App\Models\Post;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Collection;
|
||||
@@ -43,6 +45,8 @@ class SearchController extends Controller
|
||||
->add(AdditionalEducation::where('is_active', '=', true), 'title')
|
||||
->add(EducationalGroup::with('schedules'), 'title')
|
||||
->add(EducationalProgram::where('status', '=', true)->whereHas('admission_plans'), 'name')
|
||||
->add(Faculty::where('is_active', '=', true), 'title')
|
||||
->add(User::whereHas('userDetail'), ['name', 'userDetail.education', 'userDetail.awards', 'userDetail.publications',])
|
||||
->beginWithWildcard()
|
||||
->orderByRelevance()
|
||||
->includeModelType()
|
||||
|
||||
Reference in New Issue
Block a user