ヤミRoot VoidGate
User / IP
:
216.73.217.162
Host / Server
:
15.235.182.215 / pollibazaar.com
System
:
Linux asia.cbnex.com 5.14.0-611.49.2.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Apr 30 09:05:08 EDT 2026 x86_64
Command
|
Upload
|
Create
Mass Deface
|
Jumping
|
Symlink
|
Reverse Shell
Ping
|
Port Scan
|
DNS Lookup
|
Whois
|
Header
|
cURL
:
/
home
/
pollibazaar
/
public_html
/
app
/
Traits
/
Viewing: GeneratesUniqueSlug.php
<?php namespace App\Traits; use App\Contracts\Repositories\AdminRepositoryInterface; use App\Models\Admin; use App\Models\Product; use App\Models\Review; use App\Models\Seller; use App\Models\Shop; use Illuminate\Support\Str; trait GeneratesUniqueSlug { /** * Generate a unique slug for a given model type. * * @param string|null $name * @param string|null $type (e.g. 'brand', 'category', 'product') * @param int|null $id The record ID to exclude (for updates) * @return string */ public function generateModelUniqueSlug(?string $name = null, ?string $type = null, int $id = null): string { if (is_null($name) || is_null($type)) { return Str::slug(Str::random(10) . '-' . time()); } $modelClass = $this->resolveModelClass($type); $slug = Str::slug($name); $originalSlug = $slug; $count = 2; while ( $modelClass::where('slug', $slug) ->when($id, fn($q) => $q->where('id', '!=', $id)) ->exists() ) { $slug = $originalSlug . '-' . str_pad($count, 2, '0', STR_PAD_LEFT); $count++; } return $slug; } /** * Resolve the model class based on the given type. * * @param string $type * @return string */ private function resolveModelClass(string $type): string { return match (strtolower($type)) { 'brand' => \App\Models\Brand::class, 'category' => \App\Models\Category::class, // add more types here if needed default => throw new \InvalidArgumentException("Unknown type: {$type}"), }; } }
Coded With 💗 by
0x6ick