Should be:
```php
if ($request->has('slug')) {
    //...
} elseif ($request->has('id')) {}