Reputation: 691
So I'm using laravel 5.1 and I'm stuck in a weird situation.
I have 2 models Season
and 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.
Upvotes: 1
Views: 1319
Reputation: 1358
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');
Upvotes: 1