Skip to content
This repository was archived by the owner on Feb 16, 2023. It is now read-only.

Conversation

@Wolg
Copy link
Contributor

@Wolg Wolg commented Jan 25, 2017

No description provided.

@barryvdh
Copy link
Member

Can you explain what this does? And don't this works on pre-5.4

@Wolg
Copy link
Contributor Author

Wolg commented Jan 25, 2017

@barryvdh I had troubles migrating an app using cors to Laravel 5.4 this morning.
The code below doesn't do anything:
$this->app['router']->middleware('cors', HandleCors::class);
If we print results of $this->app['router']->getMiddleware() we can see that "cors" was not registered. And we have to add 'cors' => \Barryvdh\Cors\HandleCors::class into app Kerner's $routeMiddleware.
Solution here would be to use aliasMiddleware method which does the thing.
https://github.com/laravel/framework/blob/5.4/src/Illuminate/Routing/Router.php#L677

@barryvdh
Copy link
Member

Added check here to see if method exists, for <L5.4: e05c3ba

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants