Welcome Guest, Not a member yet? Register   Sign In
Route call wrong method
#5

(This post was last modified: 05-04-2021, 11:04 AM by iRedds.)

Sorry. I’m completely blind.

The problem is that under the route
$routes->delete('(:any)', 'Media::delete/$1');
fits
DELETE admin/media and DELETE admin/media/directory

You need to change the order of the routes.

first
$routes->delete('directory/(:any)', 'Media::directory/$1');
next
$routes->delete('(:any)', 'Media::delete/$1');

You're using
route_to('admin/media/files')
But the route is completely different
admin/media/files/(:any)/details

The route_to function does not find it.
In addition, you have an undefined segment, so route_to will also throw an exception.

With your route, it is more correct to define the route alias.
for example
PHP Code:
$routes->get('admin/media/files/(:any)/details''Controller::method', ['as' => 'files.details']);
// and call 
route_to('files.details'123); // admin/media/files/123/details 

But since your segment is dynamic and the code is executed on the client, you cannot use route_to().
And it is better to form the URL manually.
Reply


Messages In This Thread
Route call wrong method - by sfarzoso - 05-03-2021, 10:37 AM
RE: Route call wrong method - by iRedds - 05-03-2021, 12:01 PM
RE: Route call wrong method - by sfarzoso - 05-04-2021, 12:37 AM
RE: Route call wrong method - by sfarzoso - 05-04-2021, 02:14 AM
RE: Route call wrong method - by iRedds - 05-04-2021, 10:45 AM
RE: Route call wrong method - by sfarzoso - 05-05-2021, 12:54 AM
RE: Route call wrong method - by paliz - 05-04-2021, 11:15 AM
RE: Route call wrong method - by InsiteFX - 05-05-2021, 05:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB