add keywords during publishing

This commit is contained in:
Arno Kaimbacher 2019-03-18 14:32:29 +01:00
parent f3f17d9371
commit d9b26afb3f
13 changed files with 332 additions and 96 deletions

View file

@ -18,6 +18,7 @@ use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Validator;
use App\Models\DatasetReference;
use App\Models\Subject;
use App\Models\GeolocationBox;
use App\Models\Page;
use Illuminate\Support\Facades\Auth;
@ -66,12 +67,17 @@ class IndexController extends Controller
$titleTypes = ['sub' => 'sub', 'alternative' => 'alternative', 'translated' => 'translated', 'other' => 'other'];
$keywordTypes = ['uncontrolled' => 'uncontrolled'];
$descriptionTypes = [ 'methods' => 'methods', 'series_information' => 'series_information', 'technical_info' => 'technical_info', 'other' => 'other'];
$page = Page::query()->where('page_slug', 'terms-and-conditions')->firstOrFail();
//$relationTypes = array('updates' => 'updates', 'updated-by' => 'updated-by', 'other' => 'other');
return view('publish.create-step1', compact('licenses', 'languages', 'projects', 'relatedIdentifierTypes', 'relationTypes', 'titleTypes', 'descriptionTypes', 'page'));
return view(
'publish.create-step1',
compact('licenses', 'languages', 'projects', 'relatedIdentifierTypes', 'relationTypes', 'titleTypes', 'keywordTypes', 'descriptionTypes', 'page')
);
}
/**
@ -394,6 +400,14 @@ class IndexController extends Controller
}
}
//save keywords
if (isset($data['keywords'])) {
foreach ($request->get('keywords') as $key => $keyword) {
$dataKeyword = new Subject($keyword);
$dataset->subjects()->save($dataKeyword);
}
}
if (isset($data['geolocation'])) {
$formGeolocation = $request->input('geolocation');
if ($formGeolocation['xmin'] !== null && $formGeolocation['ymin'] !== null &&

View file

@ -5,7 +5,6 @@ use App\Http\Controllers\Controller;
use App\Http\Requests\ProjectRequest;
use App\Models\Project;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\View\View;
class CategoryController extends Controller