oai datacite metadata

This commit is contained in:
Arno Kaimbacher 2018-12-17 17:10:17 +01:00
parent 3c50618c8a
commit e7d8dc21a0
7 changed files with 308 additions and 109 deletions

View file

@ -5,6 +5,7 @@ use App\Models\Title;
use App\Models\License;
use App\Models\Person;
use App\Models\File;
use App\Models\GeolocationBox;
/**
* DatasetExtension short summary.
@ -19,7 +20,7 @@ trait DatasetExtension
protected $externalFields = array(
'TitleMain' => array(
'model' => Title::class,
'options' => array('type' => 'main'),
'options' => array('type' => ['main', 'alternative', 'subtitle', 'other']),
'fetch' => 'eager'
),
'TitleAbstract' => array(
@ -56,6 +57,11 @@ trait DatasetExtension
'relation' => 'files',
'fetch' => 'eager'
),
'GeolocationBox' => array(
'model' => GeolocationBox::class,
'relation' => 'geolocation',
'fetch' => 'eager'
),
);
protected $internalFields = array();
@ -229,7 +235,15 @@ trait DatasetExtension
if (isset($this->externalFields[$fieldname]['options'])) {
$options = $this->externalFields[$fieldname]['options'];
foreach ($options as $column => $value) {
$select = $select->where($column, $value);
// $searchString = ',';
// if (strpos($value, $searchString) !== false) {
// $arr = explode(",", $value);
if (is_array($value)) {
$arr = $value;
$select->whereIn($column, $arr);
} else {
$select = $select->where($column, $value);
}
}
}