Add new pages for gallery, sitemap, social platforms, terms, and update study destination template

- Created gallery-template.blade.php for displaying a gallery of images.
- Added sitemap.blade.php to outline the structure of the website.
- Introduced social-platform-template.blade.php for showcasing social media links.
- Implemented terms-template.blade.php to present terms and conditions.
- Updated study-destination-template.blade.php to remove redundant code and improve structure.
- Commented out dashboard toggle switch in navbar for future reference.
This commit is contained in:
2025-08-21 15:40:47 +05:45
parent 7c25b17de9
commit 8c6719e6c3
14 changed files with 1973 additions and 381 deletions

View File

@@ -16,59 +16,59 @@ class PageController extends Controller
* Display a listing of the resource.
*/
public function index(Request $request)
{
$parentPages = Page::where(['status' => 1, 'type' => 'page'])->with("children")->get();
{
$parentPages = Page::where(['status' => 1, 'type' => 'page'])->with("children")->get();
if ($request->ajax()) {
if ($request->filled("page_id")) {
$parentPage = Page::with('children')->find($request->get('page_id'));
$pages = collect([]);
if ($parentPage) {
$pages = collect([$parentPage])->merge($parentPage->children);
if ($request->ajax()) {
if ($request->filled("page_id")) {
$parentPage = Page::with('children')->find($request->get('page_id'));
$pages = collect([]);
if ($parentPage) {
$pages = collect([$parentPage])->merge($parentPage->children);
}
} else {
$pages = Page::orderBy('order')->get();
}
} else {
$pages = Page::orderBy('order')->get();
return DataTables::collection($pages)
->addIndexColumn()
->setRowClass('tableRow')
->editColumn('type', function ($page) {
return config("constants.page_type_options")[$page->type] ?? '-';
})
->editColumn('date', function ($page) {
return getFormatted(date: $page->date) ?? '-';
})
->editColumn('image', function (Page $page) {
return $page->getRawOriginal('image')
? "<img src='{$page->image}' alt='{$page->title}' class='rounded avatar-sm material-shadow ms-2 img-thumbnail'>"
: '-';
})
->addColumn('parents', function (Page $page) {
if ($page->parents->isEmpty()) {
return '-';
}
return $page->parents->map(function ($parent) {
return "<span class='badge bg-primary p-1'>{$parent->title}</span>";
})->implode(' ');
})
->editColumn('status', function (Page $page) {
$status = $page->status ? 'Published' : 'Draft';
$color = $page->status ? 'text-success' : 'text-danger';
return "<p class='{$color}'>{$status}</p>";
})
->addColumn('action', 'ccms::page.datatable.action')
->rawColumns(['parents', 'image', 'status', 'action'])
->toJson();
}
return DataTables::collection($pages)
->addIndexColumn()
->setRowClass('tableRow')
->editColumn('type', function ($page) {
return config("constants.page_type_options")[$page->type] ?? '-';
})
->editColumn('date', function ($page) {
return getFormatted(date: $page->date) ?? '-';
})
->editColumn('image', function (Page $page) {
return $page->getRawOriginal('image')
? "<img src='{$page->image}' alt='{$page->title}' class='rounded avatar-sm material-shadow ms-2 img-thumbnail'>"
: '-';
})
->addColumn('parents', function (Page $page) {
if ($page->parents->isEmpty()) {
return '-';
}
return $page->parents->map(function ($parent) {
return "<span class='badge bg-primary p-1'>{$parent->title}</span>";
})->implode(' ');
})
->editColumn('status', function (Page $page) {
$status = $page->status ? 'Published' : 'Draft';
$color = $page->status ? 'text-success' : 'text-danger';
return "<p class='{$color}'>{$status}</p>";
})
->addColumn('action', 'ccms::page.datatable.action')
->rawColumns(['parents', 'image', 'status', 'action'])
->toJson();
return view('ccms::page.index', [
'title' => 'Page List',
'parentPages' => $parentPages,
]);
}
return view('ccms::page.index', [
'title' => 'Page List',
'parentPages' => $parentPages,
]);
}
/**
* Show the form for creating a new resource.
@@ -92,7 +92,7 @@ class PageController extends Controller
$order = $maxOrder ? ++$maxOrder : 1;
$request->merge([
'order' => $order,
'status' => 0,
'status' => 1,
'slug' => $request->title == 'Homepage' ? '/' : Str::slug($request->title),
]);
}