How can I add objects that I have already returned from my database to an array on form submit? I am retrieving all of my players from my database like so,
$players = Player::all();
and outputting them like this:
<form>
@foreach($players as $player)
<ul>
<li>
<input type="checkbox" name="{{ $player->id }}">
{{ $player->fn }} {{ $player->ln }}
</li>
</ul>
@endforeach
<input type="submit" value="Submit">
</form>
This is what I consider my "player pool", where all players are loaded and available to be "checked" in. I am simply trying to have two sections on this page, one that has the player pool, and one that shows the selected players from the players pool. When a player is checked in they are added to the "players in game" section below the "player pool", and will be part of a new form that can again be submitted, but to the database instead of the same just to the page. How would I achieve this with JSON and PHP?