/** * @param array $extras * * @return void */ public function setSchemaFieldExtras($extras) { if (empty($extras)) { return; } foreach ($extras as $extra) { if (!empty($table = ArrayUtils::get($extra, 'table')) && !empty($field = ArrayUtils::get($extra, 'field'))) { if (!empty($extra['ref_table']) && empty($extra['ref_service_id'])) { // don't allow empty ref_service_id into the database, needs to be searchable from other services $extras['ref_service_id'] = $this->getServiceId(); } DbFieldExtras::updateOrCreate(['service_id' => $this->getServiceId(), 'table' => $table, 'field' => $field], array_only($extra, ['alias', 'label', 'extra_type', 'description', 'picklist', 'validation', 'client_info', 'db_function', 'ref_service_id', 'ref_table', 'ref_fields', 'ref_on_update', 'ref_on_delete'])); } } }
/** * @param array $extras * * @return void */ public function setSchemaFieldExtras($extras) { if (empty($extras)) { return; } foreach ($extras as $extra) { if (!empty($table = ArrayUtils::get($extra, 'table')) && !empty($field = ArrayUtils::get($extra, 'field'))) { DbFieldExtras::updateOrCreate(['service_id' => $this->getServiceId(), 'table' => $table, 'field' => $field], array_only($extra, ['alias', 'label', 'extra_type', 'description', 'picklist', 'validation', 'client_info'])); } } }