Code snippets
Code snippets
Copy-ready answers to everyday coding questions, each with a short explanation. Laravel, PHP, JavaScript, SQL, Bash and more.
2 snippets tagged #request · Show all
PHP
October 11, 2026
Laravel Request exists() vs has() vs filled() difference
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...
<?php
use Illuminate\Http\Request;
PHP
October 8, 2026
Laravel Form Request validation with custom messages
Moves validation out of the controller into a reusable class. Use it for any create or update endpoint; $request->validated() returns only the checked fields, w...
<?php
namespace App\Http\Requests;