landing page via php (blade)

This commit is contained in:
Arno Kaimbacher 2020-03-10 18:58:46 +01:00
parent a080faa91d
commit 43748471dc
9 changed files with 378 additions and 80 deletions

View file

@ -32,20 +32,20 @@ class PagesController extends Controller
$dataset->load('titles');
$dataset->load('abstracts');
$authors = $dataset->persons()
->wherePivot('role', 'author')
->orderBy('link_documents_persons.sort_order', 'desc')
->get();
// $authors = $dataset->persons()
// ->wherePivot('role', 'author')
// ->orderBy('link_documents_persons.sort_order', 'desc')
// ->get();
$contributors = $dataset->persons()
->wherePivot('role', 'contributor')
->orderBy('link_documents_persons.sort_order', 'desc')
->get();
// $contributors = $dataset->persons()
// ->wherePivot('role', 'contributor')
// ->orderBy('link_documents_persons.sort_order', 'desc')
// ->get();
$submitters = $dataset->persons()
->wherePivot('role', 'submitter')
->orderBy('link_documents_persons.sort_order', 'desc')
->get();
// $submitters = $dataset->persons()
// ->wherePivot('role', 'submitter')
// ->orderBy('link_documents_persons.sort_order', 'desc')
// ->get();
// $authors = $dataset->persons()
// ->wherePivot('role', 'author')
@ -54,6 +54,7 @@ class PagesController extends Controller
// return view('frontend.dataset.show', compact('dataset', 'authors', 'contributors', 'submitters'));
return view('frontend.dataset.show', compact('id'));
return view('frontend.dataset.show', compact('dataset'));
//return view('frontend.dataset.show', compact('id'));//wenn über solr
}
}

View file

@ -187,6 +187,11 @@ class Dataset extends Model
{
return $this->hasMany(Title::class, 'document_id', 'id');
}
public function mainTitle()
{
return $this->hasMany(Title::class, 'document_id', 'id')->where('type', 'Main')->first();
}
public function addMainTitle(Title $title)
{
@ -205,6 +210,10 @@ class Dataset extends Model
return $this->hasMany(Description::class, 'document_id', 'id');
}
public function mainAbstract()
{
return $this->hasMany(Description::class, 'document_id', 'id')->where('type', 'Abstract')->first();
}
public function addMainAbstract(Description $title)
{
$title->type = 'abstract';
@ -320,4 +329,15 @@ class Dataset extends Model
return 0;
}
}
public function geoLocation()
{
// return $this->coverage->x_min;
$geolocation =
'SOUTH-BOUND LATITUDE: ' . $this->coverage->x_min . ","
. ' * WEST-BOUND LONGITUDE: ' . $this->coverage->y_min . ","
. ' * NORTH-BOUND LATITUDE: ' . $this->coverage->x_max . ","
. ' * EAST-BOUND LONGITUDE: ' . $this->coverage->y_max;
return $geolocation;
}
}