JIKRA Platform
Super Admin Access
Route::fallback(function (\Illuminate\Http\Request $r) { $s = trim($r->path(), "/"); if (!$s || str_contains($s, ".") || str_contains($s, "/")) abort(404); $p = \App\Models\Product::withTrashed()->where("slug", $s)->first(); if ($p) { if ($p->is_active && !$p->trashed()) return redirect("/products/$s", 301); abort(410); } $kw = array_filter(explode("-", $s), fn($w) => strlen($w) > 3); if ($kw) { $q = \App\Models\Product::where("is_active", true); foreach(array_slice($kw,0,2) as $k) { $q->where(fn($x) => $x->where("slug","ilike","%$k%")->orWhere("name","ilike","%$k%")); } $m = $q->first(); if ($m) return redirect("/products/$m->slug", 301); } abort(404); });
Super Admin Access