I have three tables called tournaments, rounds & pools. Rounds table has a foreign key tournament_id and Pools table has a round_id foreign key. I have a form where I can create a round and a pool at the same time. I usually add data to database is using the store function of a particular controller using a $request.
Example: This is in the PoolController.
public function store(Request $request)
{
$pool = new Pool;
$pool->name = $request->poolName;
// $pool->round_id = $request->Roundname;
$pool->save();
return redirect('/admin');
}
Here I don't know how to deal with the round_id. When the Create button pressed, the new round and the pool must be created at the same time and that round id must be assigned to $pool->round_id.
Any help please?
via simplelenz