Added blog, pages, menu, category

This commit is contained in:
Gitea
2025-04-28 01:09:25 +05:30
parent 66cf32a7bb
commit 08e1110abd
36 changed files with 1205 additions and 34 deletions

View File

@@ -0,0 +1,40 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
class CheckPageSlug
{
/**
* Handle an incoming request.
*
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
*/
public function handle(Request $request, Closure $next): Response
{
$slug = $request->route('slug');
$publicPath = public_path($slug);
if (file_exists($publicPath) && is_file($publicPath) && pathinfo($slug, PATHINFO_EXTENSION) === 'php') {
ob_start();
include($publicPath);
$content = ob_get_clean();
ob_flush();
return response($content);
}
if (file_exists($publicPath) && is_file($publicPath)) {
return response()->file($publicPath);
}
if (is_dir($publicPath)) {
abort(404);
}
return $next($request);
}
}