Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
•
IT Security NachrichtenBetrüger phishen mit vermeintlicher Reisebestätigung - IT-Markt(24.09.2026 um 23:41 Uhr)
••
Sicherheitslücken (CVE)IT Security News Daily Summary 2026-09-24(24.09.2026 um 23:55 Uhr)
•
Sicherheitslücken (CVE)IT Security News Roundup: 2026-09-24(24.09.2026 um 23:57 Uhr)
•
Sicherheitslücken (CVE)IT Security News Hourly Summary 2026-09-25 00h : 9 posts(25.09.2026 um 00:00 Uhr)
•••
IT NachrichtenMicrosoft puts Brad Smith in charge of communications(25.09.2026 um 00:08 Uhr)
•••
IT Security NachrichtenBetrüger phishen mit vermeintlicher Reisebestätigung - IT-Markt(24.09.2026 um 23:41 Uhr)
••
Sicherheitslücken (CVE)IT Security News Daily Summary 2026-09-24(24.09.2026 um 23:55 Uhr)
•
Sicherheitslücken (CVE)IT Security News Roundup: 2026-09-24(24.09.2026 um 23:57 Uhr)
•
Sicherheitslücken (CVE)IT Security News Hourly Summary 2026-09-25 00h : 9 posts(25.09.2026 um 00:00 Uhr)
•••
IT NachrichtenMicrosoft puts Brad Smith in charge of communications(25.09.2026 um 00:08 Uhr)
••
Intelligence View
⚡ tsecurity.de Intelligence

Writing Clean, Flexible Query Filters in Laravel: Why I Built the QueryFilter Package

As a Laravel developer, I’ve always appreciated the elegance of Eloquent. But when it came to filtering complex queries especially when the filters depended on request parameters I found myself writing bloated controller logic or messy c…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

As a Laravel developer, I’ve always appreciated the elegance of Eloquent. But when it came to filtering complex queries especially when the filters depended on request parameters I found myself writing bloated controller logic or messy conditional clauses that just didn’t feel very “Laravel-ish.”



So I built QueryFilter a lightweight Laravel package designed to help you cleanly and fluently apply filters to your Eloquent queries, without sacrificing readability or flexibility.



Let me tell you the story behind it.






🧩 The Problem: Conditional Queries Get Messy Fast



If you’ve worked on real-world APIs, you’ve seen something like this:




$query = User::query();

if (request('name')) {
$query->where('name', 'like', '%' . request('name') . '%');
}

if (request('email')) {
$query->where('email', request('email'));
}

if (request('active')) {
$query->where('is_active', true);
}






This starts out manageable but grows into a rat’s nest as your filters expand. Moving this logic to repositories or service classes helps only so much.



I wanted a way to:




  • Decouple request parameters from query logic

  • Make filters reusable and testable

  • Keep controller code clean and focused






💡 The Solution: A Modular Query Filtering Approach



Inspired by Laravel’s pipeline pattern and modular thinking, I built QueryFilter to let you define each filter as its own class, like so:




namespace App\Filters;

use Samushi\QueryFilter\Filter;
use Illuminate\Database\Eloquent\Builder;

class Search extends Filter
{
/**
* Search results using whereLike
*
* @param Builder $builder
* @return Builder
*/

protected function applyFilter(Builder $builder): Builder
{
// Search with relationship: ['name', 'posts.title']
return $builder->whereLike(['name'], $this->getValue());
}
}






Then apply them like this:




User::queryFilter([
Name::class,
Email::class,
Active::class,
])->get();






This approach achieves single responsibility, high readability, and full testability.






⚙️ Under the Hood



QueryFilter uses a pipeline to pass the query builder through each filter class. Each filter decides whether or not to act based on the request data (or any source you inject). You can even mock them in your tests or reuse them in multiple models.



By default, it works out of the box with Laravel’s container and request lifecycle — no complex setup needed.






✅ Use Cases




  • REST API filtering: Keep controllers clean while supporting many filters

  • Admin panels: Modular filters tied to inputs like search forms or toggles

  • Reusable filters: Create a library of filter classes to apply across models






🧪 Testing and Maintenance



Because each filter is just a class with logic, testing is trivial:




public function test_name_filter_applies_like_query()
{
$query = User::query();

$filter = new Name(['name' => 'John']);
$filter->handle($query, fn($q) => $q);

$this->assertStringContainsString('like', $query->toSql());
}






This also means you can refactor or extend individual filters without affecting the rest of the query pipeline.






📦 Open Source and Ready to Use



👉 Check it out on GitHub



👉 Contributions and feedback are welcome






👋 Final Thoughts



I didn’t build QueryFilter because Laravel lacked power — I built it to make my daily workflow cleaner and more expressive. As senior developers, we care not just about what works but how it works — and more importantly, how easy it is to maintain and scale.



If you’ve ever been frustrated by sprawling query logic, I hope this package brings the same relief it brought me.



Let me know what you think or how you’d improve it.

CTI Threat Relationship Graph3 Knoten / 2 Relationen
CVE / Incident Software MITRE ATT&CK CWE Weakness IoC
SOC Incident Playbook: Remote Code Execution (RCE) Defense
Syntax validiert (0 Fehler)
title: Detect Exploitation - Writing Clean, Flexible Query Filters in Laravel: Why I Built the QueryFilter Package
id: a8435295-df30-44fd-b40b-6f559dbd40b3
status: experimental
description: Automatisch generierte SIEM-Erkennungsregel basierend auf CTI Intelligence
references:
  - https://tsecurity.de/
author: iShareStuff CTI Automated Detection Engine
date: 2026-09-25
logsource:
  category: network_connection
  product: any
detection:
  selection:
      CommandLine|contains:
        - 'exploit'
  condition: selection
falsepositives:
  - Legitime administrative Zugriffe oder Penetrationstests
level: high
tags:
  - attack.initial_access
  - attack.t1071
Syntax validiert (0 Fehler)
rule CTI_Threat_Indicator {
    meta:
        author = "iShareStuff CTI Automated Detection Engine"
        date = "2026-09-25"
        description = "YARA Signature for "
    strings:
        $str = "Writing Clean, Flexible Query " ascii wide
    condition:
        any of them
}
Syntax validiert (0 Fehler)
index=security sourcetype IN ("cisco:asa", "pan:traffic", "zeek_conn", "suricata", "WinEventLog:Security")
("Writing Clean Flexible Query Filters in ")
| stats count earliest(_time) as first_seen latest(_time) as last_seen by src_ip, dest_ip, dest_host, signature
| eval first_seen=strftime(first_seen, "%Y-%m-%d %H:%M:%S"), last_seen=strftime(last_seen, "%Y-%m-%d %H:%M:%S")
| sort - count
Syntax validiert (0 Fehler)
message: "*Writing Clean Flexible Query Filters in *"
Syntax validiert (0 Fehler)
CommonSecurityLog
| where Message has "Writing Clean Flexible Query Filters in "
| summarize EventCount = count(), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated) by SourceIP, DestinationIP, DestinationPort, Activity
| extend DetectionRule = "iShareStuff-CTI-Compiled"
| sort by EventCount desc
🎯
MITRE ATT&CK Matrix Navigator 14 Taktiken
Identifiziert: T1071Application Layer Protocol (C2)
Reconnaissance
-
Resource Development
-
Initial Access
Execution
Persistence
-
Privilege Escalation
Defense Evasion
Credential Access
-
Discovery
-
Lateral Movement
-
Collection
-
Command and Control
Exfiltration
-
Impact
tsecurity.de Cognitive Threat RAG
Fokus-Vektor:

Kognitive Analyse für identifizierte Bedrohung: Erhöhte Bedrohungslage im Bereich Writing Clean, Flexible Query Filters in.... Basierend auf 368k Vektor-Korrelationen werden sofortige Isolationsmaßnahmen für betroffene Endpunkte empfohlen.

🛡️ Angriffsfläche & Exposure

Netzwerk/Remote-Zugriff ohne Vorauthentifizierung möglich.

⚡ Empfohlene Sofortmaßnahmen
  • 1. Perimeter-Inspektion: Relevante Portfreigaben und exponierte Endpunkte unverzüglich scannen.
  • 2. Patch-Applikation: Hersteller-Hotfix einspielen oder betroffene Daemons in isolierte DMZ-Segmente überführen.
  • 3. Telemetrie & EDR-Alerts: Prozessaufrufe und Child-Processes auf anomale Shell-Spawns überwachen.
🔗 Semantisch verwandte Zero-Days MariaDB 11.7 VEC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Writing Clean, Flexible Query Filters in Laravel: Why I Built the QueryFilter Package

Thematisch verwandte Begriffe: Writing, Clean, Flexible, Query · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-87722 | Uncontrolled Resource Consumption (CWE-400 / CWE-1333) in regex search q…
Advisory →
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel • Rechts: nächster Artikel • unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel TTP ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...
↗ Original-Quelle