mattstauffer / Torch

Examples of using each Illuminate component in non-Laravel applications
MIT License
1.84k stars 211 forks source link

Plans for Upgrade to 7.0 #144

Closed jamespavett closed 4 years ago

jamespavett commented 4 years ago

Hi,

Are there any plans for an upgrade to 7.0?

Following the process for Routing, I have been able to set everything up working with 6.0 just fine. However when I used 7.0, the only error I see to have it when I pass a redirect to the UrlGenerator:

$router->redirect('/', '/menu');

// Create the redirect instance
$redirect = new Redirector(new UrlGenerator($router->getRoutes(), $request));

image

Any thoughts would be greatly appreciated.

StephaneBour commented 4 years ago

Hello @jamespavett ,

For named routes, you need to declare the need before the method, like this :

$router->name('home')->get('/', function () {
    return 'hello world!';
});

For redirect function, you can use :

$router->get('/menu',function () {
    return new RedirectResponse('/');
});