- add additional migration files

- add seeder for collections
- coverage x_min, x_max, y_min, y_max
- SitelinkController db-independent
This commit is contained in:
Arno Kaimbacher 2019-09-02 16:58:08 +02:00
parent 4d22498e2d
commit c082b4bc60
25 changed files with 463 additions and 86 deletions

View file

@ -4,6 +4,7 @@ namespace App\Http\Controllers\Frontend;
use App\Models\Dataset;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\DB;
use DateTime;
class SitelinkController extends Controller
{
@ -15,13 +16,20 @@ class SitelinkController extends Controller
$select = DB::table('documents')
->where('server_state', 'LIKE', "%" . $serverState . "%");
$select
// ->select(DB::raw('EXTRACT(YEAR FROM server_date_published) as published_date'))
// ->select(DB::raw("DATE_PART('year', server_date_published) as published_date"))
->select(DB::raw("YEAR(server_date_published) AS published_date"))
->distinct(true);
$this->years = $select->pluck('published_date');
// $select
// ->select(DB::raw('EXTRACT(YEAR FROM server_date_published) as published_date'))
// // ->select(DB::raw("DATE_PART('year', server_date_published) as published_date"))
// // ->select(DB::raw("YEAR(server_date_published) AS published_date"))
// ->distinct(true);
$years = $select->pluck('server_date_published')->toArray();
$this->years = array_map(function ($pdate) {
$dateValue = strtotime($pdate);
if ($dateValue != false) {
$year = date("Y", $dateValue);
return $year;
}
}, $years);
$this->ids = array();
return view('frontend.sitelink.index')->with(['years' => $this->years, 'documents' => $this->ids]);
}

View file

@ -66,7 +66,7 @@ class IndexController extends Controller
$keywordTypes = ['uncontrolled' => 'uncontrolled'];
$descriptionTypes = [ 'methods' => 'methods', 'series_information' => 'series_information', 'technical_info' => 'technical_info', 'translated' => 'translated', 'other' => 'other'];
$descriptionTypes = ['methods' => 'methods', 'series_information' => 'series_information', 'technical_info' => 'technical_info', 'translated' => 'translated', 'other' => 'other'];
$page = Page::query()->where('page_slug', 'terms-and-conditions')->firstOrFail();
@ -250,19 +250,19 @@ class IndexController extends Controller
'title_main.language' => 'required',
'abstract_main.value' => 'required|min:4',
'abstract_main.language' => 'required',
'coverage.xmin' => [
'coverage.x_min' => [
'nullable',
'regex:/^[-]?((((1[0-7][0-9])|([0-9]?[0-9]))\.(\d+))|180(\.0+)?)$/'
],
'coverage.ymin' => [
'coverage.y_min' => [
'nullable',
'regex:/^[-]?(([0-8]?[0-9])\.(\d+))|(90(\.0+)?)$/'
],
'coverage.xmax' => [
'coverage.x_max' => [
'nullable',
'regex:/^[-]?((((1[0-7][0-9])|([0-9]?[0-9]))\.(\d+))|180(\.0+)?)$/'
],
'coverage.ymax' => [
'coverage.y_max' => [
'nullable',
'regex:/^[-]?(([0-8]?[0-9])\.(\d+))|(90(\.0+)?)$/'
],

View file

@ -82,7 +82,7 @@ class PersonController extends Controller
'email' => 'required|email|unique:persons,email,' . $id,
'identifier_orcid' => 'nullable|min:19|max:50',
'status' => 'required|boolean',
'date_of_birth' => 'required|date'
'date_of_birth' => 'nullable|date'
]);
$person = Person::findOrFail($id);
$input = $request->all();