Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

efarook's avatar

Create a view from DB table(s) based on some inputs from a form/page

Hello! I'm relatively new in Laravel and Filament. I want to design a form/page that will take some inputs, e.g., an Id, date and a button. Click on this button should show a view containing records from DB based on those inputs.

I already designed a Filament form containing fields for Id and date. And in case of button, I used Action. All I want is to call a Controller function from this Action. I used the following code piece of code to do this:

            ->action(fn () => redirect()->route(TaskController::class, '/getat'))

Here, "getat" is the function which is defined and registered as route in the TaskController class. But clicking the action button says:

			Route [App\Http\Controllers\TaskController] not defined.

I cannot figure out what's the problem here.

Please help me out of this problem. Thanks in advance.

0 likes
1 reply
JussiMannisto's avatar

A couple of things.

Controllers handle HTTP requests. You don't call their functions directly. Also, redirect()->route() doesn't work like that - you need to pass a route name to it:

// Route definition:
Route::get('/something', [SomeController::class, 'show'])->name('some-route');

// Redirecting to that route in a controller:
return redirect()->route('some-route');

// Redirecting with parameters:
return redirect()->route('some-route', [
	'my-param' => 'my-value',
	'other-param' => 'other-value',
]);

I don't use Filament so I can't say if your approach is correct. But I wouldn't think you'd redirect manually like that. There's probably some built-in way to submit forms in Filament.

Please or to participate in this conversation.