Named Route giving error has no action (5.5)

jim1506 posted 9 months ago

I have a named route in web.php:

Route::get('editFact/{id}'.'[email protected]')->name('editFact');

In the controller I have the following:

public function edit($id) { $fc = Item::find($id); $ct = Category::orderBy('title')->get(); return view('admin.facts.edit',['fc' => $fc, 'ct' => $ct]); }

I have defined both the models in the use area.

use App\Item; use App\Category;

The view is definitely there but when I try to access it I am getting:

Route for [admin/editFact/{id}[email protected]] has no action.

I have an index function in this controller that works fine:

public function index() { return view('admin.facts.index'); }

Any ideas please? Thanks!

Tobias van Beek replied 9 months ago

If I check your code, you have a . between the route and action and not a ,

So you combine the two strings to one string and didn't provide a second parameter.

jim1506 replied 9 months ago

I feel such an idiot! Thanks Tobias!

Sign in to participate in this thread!

We'd like to thank these amazing companies for supporting us