public function create(TableRow $row, array $input) { $type = array_get($input, 'type'); $pairs = array_get($input, $type); foreach ($pairs['names'] as $key => $value) { $pair = new TablePair(['key' => $pairs['names'][$key], 'value' => $pairs['values'][$key]]); $row->pairs()->save($pair); } }
public function create(TableRow $row, array $range) { $pair = new TablePair(['key' => $range['from'], 'value' => $range['to']]); $row->pairs()->save($pair); }