1

So I'm using laravel 5.1 and I'm stuck in a weird situation.

I have 2 models Seasonand Tournament and lets say the url to add a Season model is ..../seasons/add and to view the season would be ..../seasons/(id)... standard stuff right?

But now I want to add a tournament from the link ..../seasons/1 and so I click a link that takes me to ..../tournaments/add... how can I send the Season model to that page without submitting a form with hidden input?

Currently I have this setup ..../seasons/1/tournaments/add using blade to generate the links. But this method just doesn't feel right....

Thanks.

1 Answer 1

1

How can I send data from one page to another using Laravel?: I would suggest that you do this from your controller. Take a look at Redirecting With Flashed Session Data, it might come in handy.

From the Flash Data documentation: "[...] it will only be available during the subsequent HTTP request, and then will be deleted [...]"

You can send your model, static values or whatever you want using ->with:

redirect('route')->with('key', 'value');
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.