$flat = new Flat;
$flat->flat_num = $request->flat_num;
$flat->save();
$flat->phones()->create([
'phone' => $request->phone
]);
}
<form method="post" action="/api/flats" role="form" class="form-horizontal">
{!! csrf_field() !!}
<div class="form-group">
<label for="" >Номер квартиры</label>
<input type="text" class="form-control" name="flat_num">
</div>
<div class="form-group">
@for ($i = 1; $i < 3; $i++)
<label for="" >Телефон {{$i}}</label>
<input type="text" class="form-control" name="phone[{{$i}}]">
@endfor
</div>
public function store(Request $request, Phone $phone)
{
//
$flat = new Flat;
$flat->flat_num = $request->flat_num;
$flat->save();
$flat->phones()->create([
'phone' => $phone
]);
}