tethys/app/Http/Controllers/Frontend/PagesController.php

95 lines
3.0 KiB
PHP
Raw Normal View History

2018-08-06 12:30:51 +00:00
<?php
2018-09-06 15:58:54 +00:00
namespace App\Http\Controllers\Frontend;
2015-07-19 06:49:24 +00:00
2018-09-06 15:58:54 +00:00
use App\Http\Controllers\Controller;
2018-09-10 13:09:10 +00:00
use App\Models\Dataset;
2018-08-06 12:30:51 +00:00
use Illuminate\View\View;
class PagesController extends Controller
{
public function __construct()
{
// $this->middleware('auth');
}
2018-09-06 15:58:54 +00:00
public function datasets() : View
2018-08-06 12:30:51 +00:00
{
// $books = Book::with('category', 'shelf')->orderByTitle()->get();
$documents = Dataset::orderByType()->get();
2018-09-06 15:58:54 +00:00
return view('frontend.dataset.dataset', compact('documents'));
2018-08-06 12:30:51 +00:00
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function showDoi($dataset_prefix, $id): View
{
//$dataset = Dataset::findOrFail($id);
$dataset = Dataset::where('publish_id', '=', $id)->firstOrFail();
$dataset->load('titles');
$dataset->load('abstracts');
// $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();
// $submitters = $dataset->persons()
// ->wherePivot('role', 'submitter')
// ->orderBy('link_documents_persons.sort_order', 'desc')
// ->get();
// $authors = $dataset->persons()
// ->wherePivot('role', 'author')
// ->orderBy('link_documents_persons.sort_order', 'desc')
// ->get();
// return view('frontend.dataset.show', compact('dataset', 'authors', 'contributors', 'submitters'));
return view('frontend.dataset.show', compact('dataset'));
//return view('frontend.dataset.show', compact('id'));//wenn über solr
}
public function show($id): View
2018-08-06 12:30:51 +00:00
{
//$dataset = Dataset::findOrFail($id);
$dataset = Dataset::where('publish_id', '=', $id)->firstOrFail();
2018-11-05 15:44:25 +00:00
$dataset->load('titles');
$dataset->load('abstracts');
2020-03-10 17:58:46 +00:00
// $authors = $dataset->persons()
// ->wherePivot('role', 'author')
// ->orderBy('link_documents_persons.sort_order', 'desc')
// ->get();
2018-11-05 15:44:25 +00:00
2020-03-10 17:58:46 +00:00
// $contributors = $dataset->persons()
// ->wherePivot('role', 'contributor')
// ->orderBy('link_documents_persons.sort_order', 'desc')
// ->get();
2018-11-05 15:44:25 +00:00
2020-03-10 17:58:46 +00:00
// $submitters = $dataset->persons()
// ->wherePivot('role', 'submitter')
// ->orderBy('link_documents_persons.sort_order', 'desc')
// ->get();
2018-11-05 15:44:25 +00:00
// $authors = $dataset->persons()
// ->wherePivot('role', 'author')
// ->orderBy('link_documents_persons.sort_order', 'desc')
// ->get();
2020-03-06 14:39:05 +00:00
// return view('frontend.dataset.show', compact('dataset', 'authors', 'contributors', 'submitters'));
2020-03-10 17:58:46 +00:00
return view('frontend.dataset.show', compact('dataset'));
//return view('frontend.dataset.show', compact('id'));//wenn über solr
2018-08-06 12:30:51 +00:00
}
2015-07-19 06:49:24 +00:00
}