@o227786060@gmail.com
In most cases the Facade needs to be called for these magic methods.
Import this one
Illuminate\Support\Facades\Request::input('search')
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Build Modern Laravel Apps Using Inertia.js EPISODE-17 Filtering, State, and Query Strings 07:30
The following error occursWhat details should I pay attention to Can someone point me? thanks!
Error Non-static method Illuminate\Http\Request::input() cannot be called statically
routes ->web
Route::get('/users', function () { return Inertia::render('Users', [ 'users' => User::query() ->when(Request::input('search'), function($query,$search){ $query->where('name', 'like',"%{$search}%"); })
->paginate(10)
->through(fn($user) => [
'id' => $user->id,
'name' => $user->name
]),
]);
});
Instead of
use Illuminate\Http\Request;
use
use Illuminate\Support\Facades\Request;
Please or to participate in this conversation.