# Changing URLs in Filament (Cydekick)

## How URLs are built

Filament URLs are composed of up to three parts:

```
/admin / [cluster slug] / [resource slug] / [record] / [page route]
```

---

## 1. Cluster slug (first URL segment after /admin)

**File:** `plugins/webkul/{plugin}/src/Filament/[Admin/]Clusters/{ClusterName}.php`

```php
protected static ?string $slug = 'purchase'; // controls /admin/purchase/...
```

Also set these to fix the breadcrumb label:

```php
protected static ?string $clusterBreadcrumb = 'Purchase';
protected static ?string $navigationLabel = 'Purchase';

public static function getNavigationLabel(): string
{
    return 'Purchase'; // must override the method, not just the property
}
```

**Examples changed:**
- `plugins/webkul/purchases/src/Filament/Admin/Clusters/Orders.php` — slug changed from `purchase/orders` → `purchase`
- `plugins/webkul/inventories/src/Filament/Clusters/Products.php` — slug changed from `inventory/products` → `inventory`

---

## 2. Page route (last URL segment, e.g. /quantities)

**File:** `plugins/webkul/{plugin}/src/Filament/...Resources/{ResourceName}.php`

Look for the `getPages()` method and change the route string:

```php
public static function getPages(): array
{
    return [
        'quantities' => ManageQuantities::route('/{record}/stockvaluation'),
        //                                                 ^^^^^^^^^^^^^^^ change this
    ];
}
```

**Example changed:**
- `plugins/webkul/inventories/src/Filament/Clusters/Products/Resources/ProductResource.php` — `/{record}/quantities` → `/{record}/stockvaluation`

---

## 3. After any URL change — clear caches

```bash
php artisan cache:clear
php artisan route:clear
php artisan config:clear
php artisan view:clear
```

---

## Notes

- Changing the cluster slug affects **all resources** in that cluster simultaneously.
- The breadcrumb first segment comes from `getClusterBreadcrumb()` on the cluster — it checks `$clusterBreadcrumb` then `$title` then derives from the class name. The `$navigationLabel` property alone is **not** enough; the `getNavigationLabel()` method must also be updated if it exists.
- Page route slugs (like `quantities`) only affect that one page's URL.
