Route() in controller


#1

Hi!

Is there a way to use route() in controllers?

Ex:

return response.json({
   status: true,
   redirect: route('admin:dashboard')
});

Its a login by ajax.

Thx


#2

Simply import Route inside your controller

const Route = use('Route')

return response.json({
   status: true,
   redirect: Route.url('admin:dashboard')
});