Laravel Request exists() vs has() vs filled() difference
PHP Dasun Kalupahana 326 views
<?php
use Illuminate\Http\Request;
// Request: ?name=&age=0&city
public function show(Request $request)
{
$request->has('name'); // true (key present, value is "")
$request->exists('name'); // true (alias of has)
$request->filled('name'); // false (value is empty)
$request->has('age'); // true
$request->filled('age'); // true (0 counts as filled)
$request->has('country'); // false (key not sent)
$request->missing('country'); // true
$request->hasAny(['name', 'country']); // true (at least one key is present)
}
exists() is an alias of has(), and both only check that the key was sent, even when its value is empty or null. Use filled() when you need a non-empty value and missing() when the key must be absent.
Learn more on the blog
MySQL
PostgreSQL vs MySQL Performance: Real Benchmarks Compared
Last updated: 7 November 2026. See the update log at the end."Which...
8 min read
PHP
How to Detect and Fix PHP Memory Leaks
Last updated: 5 November 2026. See the update log at the end.In...
9 min read
Docker
Docker Build Too Slow? 10 Ways to Speed It Up
A slow Docker build usually has one of a few causes: you...
8 min read