Add initial website setup: Created essential files including package-lock.json, setup documentation, and foundational Blade templates. Implemented PageController for homepage and page display, integrated navigation and footer components, and established dark mode functionality. Enhanced CSS for custom scrollbar and smooth scrolling. Added SVG logos for branding. Updated routes for page handling.

This commit is contained in:
Ümit Tunç
2025-10-01 02:21:31 -03:00
parent dc0abb83da
commit 736f9c536d
15 changed files with 3276 additions and 4 deletions
+68
View File
@@ -0,0 +1,68 @@
<?php
namespace App\Http\Controllers;
use App\Models\Page;
use Illuminate\Http\Request;
class PageController extends Controller
{
/**
* Display the homepage or a specific page
*/
public function index()
{
// Homepage'i bul
$page = Page::where('is_homepage', true)
->where('status', 'published')
->first();
if (!$page) {
// Homepage yoksa, view'e boş geçelim
return view('home', [
'page' => null,
'menuItems' => $this->getMenuItems()
]);
}
return view('home', [
'page' => $page,
'menuItems' => $this->getMenuItems()
]);
}
/**
* Display a specific page by slug
*/
public function show($slug)
{
$page = Page::where('slug', $slug)
->where('status', 'published')
->firstOrFail();
return view('page', [
'page' => $page,
'menuItems' => $this->getMenuItems()
]);
}
/**
* Get menu items for navigation
*/
private function getMenuItems()
{
return Page::with(['children' => function ($query) {
$query->where('status', 'published')
->where('show_in_menu', true)
->orderBy('sort_order', 'asc')
->orderBy('title', 'asc');
}])
->whereNull('parent_id')
->where('status', 'published')
->where('show_in_menu', true)
->orderBy('sort_order', 'asc')
->orderBy('title', 'asc')
->get();
}
}