Laravel-log-viewer: Lumen 5.3 Redirect not implemented

Created on 3 Oct 2016  ·  6Comments  ·  Source: rap2hpoutre/laravel-log-viewer

we need to fix the controller b/c Redirect is not working

clicking delete gives:

"message": "Class redirect does not exist",
"exception": "ReflectionException",

cheers max

Most helpful comment

@mstaack Since version 5.2, Lumen uses a different Redirector class (other than Illuminate's) and no longer offers a container alias for the Redirector class or the Redirect Facade out of the box. So you should do them yourself.

In your bootstrap/app.php, add the following code

$app->withFacades(true, [
    'Illuminate\Support\Facades\Redirect' => 'Redirect'
]);
$app->bind('redirect', 'Laravel\Lumen\Http\Redirector');

@rap2hpoutre In the LogViewerController, you may want to consider using redirect() helper function instead of the Redirect facade since the it will have the same behaviour in both Laravel and Lumen without extra configuration.

All 6 comments

I've just tried with a fresh install of Lumen 5.3, and it works. Did you missed this step?

Enable facades by uncommenting this line in bootstrap/app.php:

$app->withFacades();

yeah i do have facades activated....weird...i am getting this error

this error occurred while deleting a log file

@mstaack Since version 5.2, Lumen uses a different Redirector class (other than Illuminate's) and no longer offers a container alias for the Redirector class or the Redirect Facade out of the box. So you should do them yourself.

In your bootstrap/app.php, add the following code

$app->withFacades(true, [
    'Illuminate\Support\Facades\Redirect' => 'Redirect'
]);
$app->bind('redirect', 'Laravel\Lumen\Http\Redirector');

@rap2hpoutre In the LogViewerController, you may want to consider using redirect() helper function instead of the Redirect facade since the it will have the same behaviour in both Laravel and Lumen without extra configuration.

@elghobaty Thank for your analysis and the workaround! redirect() helper does not seem to exist in Laravel 4.2 and this package is still compatible (I hope) with Laravel 4.2, that's why I don't want to change it. Maybe we should use redirect() if it exists and Redirect façade if not? Feel free to submit a PR if you think it's OK and I will merge it.

Fixed in v0.7.1 (thanks to @elghobaty)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

serdarsaygili picture serdarsaygili  ·  11Comments

akoepcke picture akoepcke  ·  9Comments

rap2hpoutre picture rap2hpoutre  ·  7Comments

avesgit picture avesgit  ·  7Comments

watermelonjuice picture watermelonjuice  ·  8Comments