cesargb / laravel-magiclink

Create link for authenticate in Laravel without password or get private content
MIT License
383 stars 44 forks source link

Serialization of 'Closure' is not allowed #63

Closed marvinosswald closed 2 years ago

marvinosswald commented 2 years ago

as in your example i'm trying to redirect with the following line $action->response(redirect(route('drop.private', ['drop' => $drop])));

if i use:

$action->redirect(route('drop.private', ['drop' => $drop]));

it works but only writes out the url not a location header.

Laravel 9 PHP 8.1 magiclink ^2.12

cesargb commented 2 years ago

Hi @marvinosswald!

you can use Redirecting To Named Routes

In your case:

$redirectToDropPrivate = redirect()->route('drop.private', ['drop' => $drop]);

$action->response($redirectToDropPrivate);

I hope this can help you

marvinosswald commented 2 years ago

Hi @cesargb

Thanks for your quick response, sadly i tried that as well and again now - same result.

$action->response(redirect()->route('drop.private', ['drop' => $drop]));

marvinosswald commented 2 years ago

I found a workaround:

new RedirectResponse(route('drop.private', ['drop' => $drop]))