all models into model folder
This commit is contained in:
parent
98f50a2b6f
commit
6990469c67
|
@ -17,7 +17,7 @@ class Book extends Model
|
|||
|
||||
public function project()
|
||||
{
|
||||
return $this->belongsTo('App\Project', 'project_id', 'id');
|
||||
return $this->belongsTo('App\Models\Project', 'project_id', 'id');
|
||||
}
|
||||
|
||||
// public function shelf()
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Collection extends Model
|
||||
{
|
||||
|
||||
public function documents()
|
||||
{
|
||||
return $this->belongsToMany(\App\Dataset::class, 'link_documents_collections', 'collection_id', 'document_id');
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\User;
|
||||
use App\Models\User;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace App\Http\Controllers;
|
|||
use App\Http\Requests;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Book;
|
||||
use App\Project;
|
||||
use App\Models\Project;
|
||||
use App\Shelf;
|
||||
use App\Http\Requests\BookRequest;
|
||||
use Illuminate\Http\Request;
|
||||
|
|
|
@ -5,14 +5,12 @@ use App\Http\Controllers\Controller;
|
|||
use App\Book;
|
||||
use App\Person;
|
||||
use App\Transaction;
|
||||
use App\Project;
|
||||
use App\Models\Project;
|
||||
use App\Http\Requests\PeminjamanRequest;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class BorrowController extends Controller
|
||||
{
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
|
|
|
@ -17,6 +17,10 @@ class HomeController extends Controller
|
|||
{
|
||||
//$this->middleware('auth');
|
||||
}
|
||||
public function test(): View
|
||||
{
|
||||
return view('welcome');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application dashboard.
|
||||
|
@ -43,7 +47,6 @@ class HomeController extends Controller
|
|||
|
||||
// }
|
||||
return view('frontend.home.index');
|
||||
// return view('welcome');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Dataset;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Dataset;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class PagesController extends Controller
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Book;
|
||||
use App\Dataset;
|
||||
use App\Models\Dataset;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Library\Search\Navigation;
|
||||
use App\Library\Util\SolrSearchSearcher;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Models\Dataset;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Dataset;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class SitelinkController extends Controller
|
||||
|
@ -24,7 +24,7 @@ class SitelinkController extends Controller
|
|||
return view('frontend.sitelink.index')->with(['years' => $this->years, 'documents' => $this->ids]);
|
||||
}
|
||||
|
||||
public function list($year)
|
||||
public function listDocs($year)
|
||||
{
|
||||
$this->index();
|
||||
if (preg_match('/^\d{4}$/', $year) > 0) {
|
||||
|
|
|
@ -3,9 +3,8 @@ namespace App\Http\Controllers\Oai;
|
|||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Dataset;
|
||||
use App\Models\Dataset;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Book;
|
||||
|
||||
class RequestController extends Controller
|
||||
{
|
||||
|
@ -15,7 +14,7 @@ class RequestController extends Controller
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_deliveringDocumentStates = array('published', 'deleted'); // maybe deleted documents too
|
||||
private $deliveringDocumentStates = array('published', 'deleted'); // maybe deleted documents too
|
||||
const SET_SPEC_PATTERN = '[A-Za-z0-9\-_\.!~\*\'\(\)]+';
|
||||
|
||||
|
||||
|
@ -31,7 +30,7 @@ class RequestController extends Controller
|
|||
*
|
||||
* @var \DomDocument Defaults to null.
|
||||
*/
|
||||
protected $_xslt = null;
|
||||
protected $xslt = null;
|
||||
|
||||
/**
|
||||
* Holds the xslt processor.
|
||||
|
@ -47,9 +46,9 @@ class RequestController extends Controller
|
|||
*/
|
||||
private function loadStyleSheet($stylesheet)
|
||||
{
|
||||
$this->_xslt = new \DomDocument;
|
||||
$this->_xslt->load($stylesheet);
|
||||
$this->_proc->importStyleSheet($this->_xslt);
|
||||
$this->xslt = new \DomDocument;
|
||||
$this->xslt->load($stylesheet);
|
||||
$this->_proc->importStyleSheet($this->xslt);
|
||||
if (isset($_SERVER['HTTP_HOST'])) {
|
||||
$this->_proc->setParameter('', 'host', $_SERVER['HTTP_HOST']);
|
||||
}
|
||||
|
@ -91,22 +90,22 @@ class RequestController extends Controller
|
|||
if (isset($oaiRequest['verb'])) {
|
||||
$this->_proc->setParameter('', 'oai_verb', $oaiRequest['verb']);
|
||||
if ($oaiRequest['verb'] == 'Identify') {
|
||||
$this->_handleIdentify();
|
||||
$this->handleIdentify();
|
||||
} elseif ($oaiRequest['verb'] == 'ListMetadataFormats') {
|
||||
$this->_handleListMetadataFormats();
|
||||
$this->handleListMetadataFormats();
|
||||
} elseif ($oaiRequest['verb'] == 'ListRecords') {
|
||||
$this->_handleListRecords($oaiRequest);
|
||||
$this->handleListRecords($oaiRequest);
|
||||
} elseif ($oaiRequest['verb'] == 'ListIdentifiers') {
|
||||
$this->_handleListIdentifiers($oaiRequest);
|
||||
$this->handleListIdentifiers($oaiRequest);
|
||||
} elseif ($oaiRequest['verb'] == 'ListSets') {
|
||||
$this->_handleListSets($oaiRequest);
|
||||
$this->handleListSets($oaiRequest);
|
||||
} else {
|
||||
$this->_handleIllegalVerb();
|
||||
$this->handleIllegalVerb();
|
||||
}
|
||||
} else {
|
||||
$oaiRequest['verb'] = 'Identify';
|
||||
$this->_proc->setParameter('', 'oai_verb', $oaiRequest['verb']);
|
||||
$this->doc = $this->_handleIdentify();
|
||||
$this->doc = $this->handleIdentify();
|
||||
}
|
||||
|
||||
//$xml = $this->_xml->saveXML();
|
||||
|
@ -123,7 +122,7 @@ class RequestController extends Controller
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _handleIdentify()
|
||||
private function handleIdentify()
|
||||
{
|
||||
$email = "repository@geologie.ac.at";
|
||||
$repositoryName = "Data Research Repository";
|
||||
|
@ -149,7 +148,7 @@ class RequestController extends Controller
|
|||
* @param array &$oaiRequest Contains full request information
|
||||
* @return void
|
||||
*/
|
||||
private function _handleListMetadataFormats()
|
||||
private function handleListMetadataFormats()
|
||||
{
|
||||
$this->_xml->appendChild($this->_xml->createElement('Documents'));
|
||||
}
|
||||
|
@ -160,10 +159,10 @@ class RequestController extends Controller
|
|||
* @param array &$oaiRequest Contains full request information
|
||||
* @return void
|
||||
*/
|
||||
private function _handleListRecords($oaiRequest)
|
||||
private function handleListRecords($oaiRequest)
|
||||
{
|
||||
$maxRecords = 20;//$this->_configuration->getMaxListRecords();
|
||||
$this->_handlingOfLists($oaiRequest, $maxRecords);
|
||||
$this->handlingOfLists($oaiRequest, $maxRecords);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -172,10 +171,10 @@ class RequestController extends Controller
|
|||
* @param array &$oaiRequest Contains full request information
|
||||
* @return void
|
||||
*/
|
||||
private function _handleListIdentifiers(array &$oaiRequest)
|
||||
private function handleListIdentifiers(array &$oaiRequest)
|
||||
{
|
||||
$maxIdentifier = 20;//$this->_configuration->getMaxListIdentifiers();
|
||||
$this->_handlingOfLists($oaiRequest, $maxIdentifier);
|
||||
$this->handlingOfLists($oaiRequest, $maxIdentifier);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -184,7 +183,7 @@ class RequestController extends Controller
|
|||
* @param array &$oaiRequest Contains full request information
|
||||
* @return void
|
||||
*/
|
||||
private function _handleListSets()
|
||||
private function handleListSets()
|
||||
{
|
||||
$repIdentifier = "rdr.gba.ac.at";
|
||||
$this->_proc->setParameter('', 'repIdentifier', $repIdentifier);
|
||||
|
@ -216,7 +215,7 @@ class RequestController extends Controller
|
|||
}
|
||||
|
||||
|
||||
private function _handleIllegalVerb()
|
||||
private function handleIllegalVerb()
|
||||
{
|
||||
$this->_proc->setParameter('', 'oai_error_code', 'badVerb');
|
||||
$this->_proc->setParameter('', 'oai_error_message', 'The verb provided in the request is illegal.');
|
||||
|
@ -231,7 +230,7 @@ class RequestController extends Controller
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _handlingOfLists(array &$oaiRequest, $maxRecords)
|
||||
private function handlingOfLists(array &$oaiRequest, $maxRecords)
|
||||
{
|
||||
if (true === empty($maxRecords)) {
|
||||
$maxRecords = 100;
|
||||
|
@ -255,7 +254,7 @@ class RequestController extends Controller
|
|||
// no resumptionToken is given
|
||||
$finder = Dataset::query();
|
||||
// add server state restrictions
|
||||
$finder->whereIn('server_state', $this->_deliveringDocumentStates);
|
||||
$finder->whereIn('server_state', $this->deliveringDocumentStates);
|
||||
if (array_key_exists('set', $oaiRequest)) {
|
||||
$setarray = explode(':', $oaiRequest['set']);
|
||||
if ($setarray[0] == 'doc-type') {
|
||||
|
@ -283,7 +282,7 @@ class RequestController extends Controller
|
|||
//$node = $this->_xml->createElement('Rdr_Dataset');
|
||||
$domNode = $this->getDatasetXmlDomNode($dataset);
|
||||
// add frontdoor url
|
||||
$this->_addLandingPageAttribute($domNode, $dataset->id);
|
||||
$this->addLandingPageAttribute($domNode, $dataset->id);
|
||||
|
||||
// add access rights to element
|
||||
//$this->_addAccessRights($domNode, $dataset);
|
||||
|
@ -301,8 +300,8 @@ class RequestController extends Controller
|
|||
//$node->appendChild($child);
|
||||
|
||||
//$type = $dataset->type;
|
||||
$this->_addSpecInformation($node, 'doc-type:' . $dataset->type);
|
||||
//$this->_addSpecInformation($node, 'bibliography:' . 'false');
|
||||
$this->addSpecInformation($node, 'doc-type:' . $dataset->type);
|
||||
//$this->addSpecInformation($node, 'bibliography:' . 'false');
|
||||
|
||||
$this->_xml->documentElement->appendChild($node);
|
||||
}
|
||||
|
@ -314,7 +313,7 @@ class RequestController extends Controller
|
|||
* @param string $docid Id of the dataset
|
||||
* @return void
|
||||
*/
|
||||
private function _addLandingPageAttribute(\DOMNode $document, $dataid)
|
||||
private function addLandingPageAttribute(\DOMNode $document, $dataid)
|
||||
{
|
||||
$url = route('frontend.dataset.show', $dataid);
|
||||
|
||||
|
@ -324,7 +323,7 @@ class RequestController extends Controller
|
|||
$document->appendChild($attr);
|
||||
}
|
||||
|
||||
private function _addSpecInformation(\DOMNode $document, $information)
|
||||
private function addSpecInformation(\DOMNode $document, $information)
|
||||
{
|
||||
$setSpecAttribute = $this->_xml->createAttribute('Value');
|
||||
$setSpecAttributeValue = $this->_xml->createTextNode($information);
|
||||
|
@ -338,7 +337,7 @@ class RequestController extends Controller
|
|||
|
||||
private function getDatasetXmlDomNode($dataset)
|
||||
{
|
||||
if (!in_array($dataset->server_state, $this->_deliveringDocumentStates)) {
|
||||
if (!in_array($dataset->server_state, $this->deliveringDocumentStates)) {
|
||||
$message = 'Trying to get a document in server state "' . $dataset->server_state . '"';
|
||||
//Zend_Registry::get('Zend_Log')->err($message);
|
||||
Log::error("server state: $message");
|
||||
|
@ -349,7 +348,7 @@ class RequestController extends Controller
|
|||
$xmlModel = new \App\Library\Xml\XmlModel();
|
||||
$xmlModel->setModel($dataset);
|
||||
$xmlModel->excludeEmptyFields();
|
||||
$xmlModel->setXmlCache(new \App\XmlCache());
|
||||
$xmlModel->setXmlCache(new \App\Models\XmlCache());
|
||||
return $xmlModel->getDomDocument()->getElementsByTagName('Rdr_Dataset')->item(0);
|
||||
}
|
||||
|
||||
|
@ -362,7 +361,7 @@ class RequestController extends Controller
|
|||
$setSpecPattern = self::SET_SPEC_PATTERN;
|
||||
$sets = array();
|
||||
|
||||
$finder = new \App\DatasetFinder();
|
||||
$finder = new \App\Models\DatasetFinder();
|
||||
$finder->setServerState('published');
|
||||
foreach ($finder->groupedTypesPlusCount() as $doctype => $row) {
|
||||
if (0 == preg_match("/^$setSpecPattern$/", $doctype)) {
|
||||
|
@ -383,14 +382,22 @@ class RequestController extends Controller
|
|||
private function handleIdentifyOld()
|
||||
{
|
||||
//$earliestDateFromDb = Opus_Document::getEarliestPublicationDate();
|
||||
//$earliestDateFromDb = Dataset::select('server_date_created')->orderBy('server_date_created', 'desc')->first()->toDateTimeString();
|
||||
// $earliestDateFromDb = Dataset::select('server_date_created')
|
||||
// ->orderBy('server_date_created', 'desc')
|
||||
// ->first()->toDateTimeString();
|
||||
$earliestDateFromDb = Dataset::earliestPublicationDate();
|
||||
|
||||
$sxe = new \SimpleXMLElement('<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="xsl/oai2.xslt"?><OAI-PMH/>');
|
||||
$sxe = new \SimpleXMLElement(
|
||||
'<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="xsl/oai2.xslt"?><OAI-PMH/>'
|
||||
);
|
||||
|
||||
$sxe->addAttribute('xmlns', 'http://www.openarchives.org/OAI/2.0/');
|
||||
$sxe->addAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
|
||||
$sxe->addAttribute('xmlns:mml', 'http://www.w3.org/1998/Math/MathML');
|
||||
$sxe->addAttribute('xsi:schemaLocation', 'http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd');
|
||||
$sxe->addAttribute(
|
||||
'xsi:schemaLocation',
|
||||
'http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd'
|
||||
);
|
||||
$sxe->addChild('responseDate', date("Y-m-d\TH:i:s\Z"));
|
||||
|
||||
$uri = explode('?', $_SERVER['REQUEST_URI'], 2);
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
//https://www.5balloons.info/multi-page-step-form-in-laravel-with-validation/
|
||||
namespace App\Http\Controllers\Publish;
|
||||
|
||||
use App\Dataset;
|
||||
use App\Models\Dataset;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\License;
|
||||
use App\Models\License;
|
||||
use App\Models\File;
|
||||
use App\Person;
|
||||
use App\Project;
|
||||
use App\Models\Person;
|
||||
use App\Models\Project;
|
||||
use App\Models\Title;
|
||||
use App\Rules\RdrFiletypes;
|
||||
use App\Rules\RdrFilesize;
|
||||
|
|
|
@ -3,7 +3,7 @@ namespace App\Http\Controllers\Settings\Access;
|
|||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Role;
|
||||
use App\User;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UserController extends Controller
|
||||
|
|
|
@ -3,7 +3,7 @@ namespace App\Http\Controllers\Settings;
|
|||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\ProjectRequest;
|
||||
use App\Project;
|
||||
use App\Models\Project;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace App\Http\Controllers\Settings;
|
|||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Collection;
|
||||
use App\Models\Collection;
|
||||
|
||||
class CollectionController extends Controller
|
||||
{
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
namespace App\Http\Controllers\Settings;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Dataset;
|
||||
use App\Project;
|
||||
use App\License;
|
||||
use App\Models\Dataset;
|
||||
use App\Models\Project;
|
||||
use App\Models\License;
|
||||
use App\Models\Title;
|
||||
use App\Http\Requests\DocumentRequest;
|
||||
use Illuminate\View\View;
|
||||
|
@ -33,9 +33,6 @@ class DatasetController extends Controller
|
|||
} else {
|
||||
$state = "published";
|
||||
}
|
||||
|
||||
|
||||
|
||||
$data = $request->all();
|
||||
|
||||
if ($searchType == "simple") {
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
namespace App\Http\Controllers\Settings;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\License;
|
||||
use App\Language;
|
||||
use App\Models\License;
|
||||
use App\Models\Language;
|
||||
use App\Http\Requests\LicenseRequest;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
namespace App\Http\Controllers\Settings;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Person;
|
||||
use App\Models\Person;
|
||||
use App\Http\Requests\PersonRequest;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
|
|
@ -56,6 +56,7 @@ class Kernel extends HttpKernel
|
|||
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
|
||||
// 'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class,
|
||||
// 'perm' => \App\Http\Middleware\PermissionMiddleware::class,
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
<?php
|
||||
namespace App\Library\Xml;
|
||||
|
||||
use App\Library\Util\Searchtypes;
|
||||
use App\Dataset;
|
||||
use App\Models\Dataset;
|
||||
|
||||
/**
|
||||
* Conf short summary.
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
namespace App\Library\Xml;
|
||||
|
||||
use App\Models\Title;
|
||||
use App\Models\License;
|
||||
use App\Models\Person;
|
||||
use App\Models\File;
|
||||
|
||||
/**
|
||||
* DatasetExtension short summary.
|
||||
|
@ -13,7 +16,7 @@ use App\Models\Title;
|
|||
*/
|
||||
trait DatasetExtension
|
||||
{
|
||||
protected $_externalFields = array(
|
||||
protected $externalFields = array(
|
||||
'TitleMain' => array(
|
||||
'model' => Title::class,
|
||||
'options' => array('type' => 'main'),
|
||||
|
@ -25,13 +28,13 @@ trait DatasetExtension
|
|||
'fetch' => 'eager'
|
||||
),
|
||||
'Licence' => array(
|
||||
'model' => 'App\License',
|
||||
'model' => License::class,
|
||||
'through' => 'link_documents_licences',
|
||||
'relation' => 'licenses',
|
||||
'fetch' => 'eager'
|
||||
),
|
||||
'PersonAuthor' => array(
|
||||
'model' => 'App\Person',
|
||||
'model' => Person::class,
|
||||
'through' => 'link_documents_persons',
|
||||
'pivot' => array('role' => 'author'),
|
||||
//'sort_order' => array('sort_order' => 'ASC'), // <-- We need a sorted authors list.
|
||||
|
@ -40,7 +43,7 @@ trait DatasetExtension
|
|||
'fetch' => 'eager'
|
||||
),
|
||||
'PersonContributor' => array(
|
||||
'model' => 'App\Person',
|
||||
'model' => Person::class,
|
||||
'through' => 'link_documents_persons',
|
||||
'pivot' => array('role' => 'contributor'),
|
||||
// 'sort_order' => array('sort_order' => 'ASC'), // <-- We need a sorted authors list.
|
||||
|
@ -49,15 +52,15 @@ trait DatasetExtension
|
|||
'fetch' => 'eager'
|
||||
),
|
||||
'File' => array(
|
||||
'model' => 'App\Models\File',
|
||||
'model' => File::class,
|
||||
'relation' => 'files',
|
||||
'fetch' => 'eager'
|
||||
),
|
||||
);
|
||||
|
||||
protected $_internalFields = array();
|
||||
protected $internalFields = array();
|
||||
|
||||
protected $_fields = array();
|
||||
protected $fields = array();
|
||||
|
||||
protected function _initFields()
|
||||
{
|
||||
|
@ -90,7 +93,7 @@ trait DatasetExtension
|
|||
$this->addField($field);
|
||||
}
|
||||
|
||||
foreach (array_keys($this->_externalFields) as $fieldname) {
|
||||
foreach (array_keys($this->externalFields) as $fieldname) {
|
||||
$field = new Field($fieldname);
|
||||
$field->setMultiplicity('*');
|
||||
$this->addField($field);
|
||||
|
@ -112,21 +115,21 @@ trait DatasetExtension
|
|||
|
||||
/**
|
||||
* Get a list of all fields attached to the model. Filters all fieldnames
|
||||
* that are defined to be inetrnal in $_internalFields.
|
||||
* that are defined to be inetrnal in $internalFields.
|
||||
*
|
||||
* @see Opus_Model_Abstract::_internalFields
|
||||
* @see Opus_Model_Abstract::internalFields
|
||||
* @return array List of fields
|
||||
*/
|
||||
public function describe()
|
||||
{
|
||||
return array_diff(array_keys($this->_fields), $this->_internalFields);
|
||||
return array_diff(array_keys($this->fields), $this->internalFields);
|
||||
}
|
||||
|
||||
public function addField(Field $field)
|
||||
{
|
||||
$fieldname = $field->getName();
|
||||
if (isset($fieldname, $this->_externalFields[$fieldname])) {
|
||||
$options = $this->_externalFields[$fieldname];
|
||||
if (isset($fieldname, $this->externalFields[$fieldname])) {
|
||||
$options = $this->externalFields[$fieldname];
|
||||
|
||||
// set ValueModelClass if a through option is given
|
||||
if (isset($options['model'])) {
|
||||
|
@ -139,7 +142,7 @@ trait DatasetExtension
|
|||
//}
|
||||
}
|
||||
|
||||
$this->_fields[$field->getName()] = $field;
|
||||
$this->fields[$field->getName()] = $field;
|
||||
$field->setOwningModelClass(get_class($this));
|
||||
return $this;
|
||||
}
|
||||
|
@ -157,8 +160,8 @@ trait DatasetExtension
|
|||
*/
|
||||
protected function _getField($name)
|
||||
{
|
||||
if (isset($this->_fields[$name])) {
|
||||
return $this->_fields[$name];
|
||||
if (isset($this->fields[$name])) {
|
||||
return $this->fields[$name];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
@ -167,11 +170,11 @@ trait DatasetExtension
|
|||
public function fetchValues()
|
||||
{
|
||||
$this->_initFields();
|
||||
foreach ($this->_fields as $fieldname => $field) {
|
||||
if (isset($this->_externalFields[$fieldname]) === true) {
|
||||
foreach ($this->fields as $fieldname => $field) {
|
||||
if (isset($this->externalFields[$fieldname]) === true) {
|
||||
$fetchmode = 'lazy';
|
||||
if (isset($this->_externalFields[$fieldname]['fetch']) === true) {
|
||||
$fetchmode = $this->_externalFields[$fieldname]['fetch'];
|
||||
if (isset($this->externalFields[$fieldname]['fetch']) === true) {
|
||||
$fetchmode = $this->externalFields[$fieldname]['fetch'];
|
||||
}
|
||||
|
||||
if ($fetchmode === 'lazy') {
|
||||
|
@ -210,7 +213,7 @@ trait DatasetExtension
|
|||
|
||||
protected function _loadExternal($fieldname)
|
||||
{
|
||||
$field = $this->_fields[$fieldname];
|
||||
$field = $this->fields[$fieldname];
|
||||
|
||||
$modelclass = $field->getLinkModelClass();
|
||||
if (!isset($modelclass)) {
|
||||
|
@ -223,8 +226,8 @@ trait DatasetExtension
|
|||
$select = $tableclass->query();//->where("document_id", $this->id);;
|
||||
|
||||
// If any declared constraints, add them to query
|
||||
if (isset($this->_externalFields[$fieldname]['options'])) {
|
||||
$options = $this->_externalFields[$fieldname]['options'];
|
||||
if (isset($this->externalFields[$fieldname]['options'])) {
|
||||
$options = $this->externalFields[$fieldname]['options'];
|
||||
foreach ($options as $column => $value) {
|
||||
$select = $select->where($column, $value);
|
||||
}
|
||||
|
@ -236,17 +239,17 @@ trait DatasetExtension
|
|||
$datasetId = $this->id;
|
||||
|
||||
$rows = array();
|
||||
if (isset($this->_externalFields[$fieldname]['through'])) {
|
||||
$relation = $this->_externalFields[$fieldname]['relation'];
|
||||
if (isset($this->externalFields[$fieldname]['through'])) {
|
||||
$relation = $this->externalFields[$fieldname]['relation'];
|
||||
//$rows = $select->datasets
|
||||
////->orderBy('name')
|
||||
//->get();
|
||||
//$licenses = $select->with('datasets')->get();
|
||||
//$rows = $supplier->datasets;
|
||||
$rows = $this->{$relation};
|
||||
//if (isset($this->_externalFields[$fieldname]['pivot']))
|
||||
//if (isset($this->externalFields[$fieldname]['pivot']))
|
||||
//{
|
||||
// $pivArray = $this->_externalFields[$fieldname]['pivot'];
|
||||
// $pivArray = $this->externalFields[$fieldname]['pivot'];
|
||||
// $rows = $rows->wherePivot('role', $pivArray['role']);
|
||||
//}
|
||||
} else {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
namespace App\Library\Xml;
|
||||
|
||||
use App\Dataset;
|
||||
use App\Models\Dataset;
|
||||
use DOMDocument;
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
namespace App\Library\Xml;
|
||||
|
||||
use App\XmlCache;
|
||||
use App\Models\XmlCache;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class XmlModel
|
||||
|
@ -24,19 +24,19 @@ class XmlModel
|
|||
* Holds current configuration.
|
||||
* @var Conf
|
||||
*/
|
||||
private $_config = null;
|
||||
private $config = null;
|
||||
|
||||
/**
|
||||
* Holds current xml strategy object.
|
||||
* @var Strategy
|
||||
*/
|
||||
private $_strategy = null;
|
||||
private $strategy = null;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* @var XmlCache
|
||||
*/
|
||||
private $_cache = null;
|
||||
private $cache = null;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -45,9 +45,9 @@ class XmlModel
|
|||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->_strategy = new Strategy();// Opus_Model_Xml_Version1;
|
||||
$this->_config = new Conf();
|
||||
$this->_strategy->setup($this->_config);
|
||||
$this->strategy = new Strategy();// Opus_Model_Xml_Version1;
|
||||
$this->config = new Conf();
|
||||
$this->strategy->setup($this->config);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -59,8 +59,8 @@ class XmlModel
|
|||
*/
|
||||
public function setStrategy(Strategy $strategy)
|
||||
{
|
||||
$this->_strategy = $strategy;
|
||||
$this->_strategy->setup($this->_config);
|
||||
$this->strategy = $strategy;
|
||||
$this->strategy->setup($this->config);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ class XmlModel
|
|||
*/
|
||||
public function setXmlCache(XmlCache $cache)
|
||||
{
|
||||
$this->_cache = $cache;
|
||||
$this->cache = $cache;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -84,19 +84,19 @@ class XmlModel
|
|||
*/
|
||||
public function getXmlCache()
|
||||
{
|
||||
return $this->_cache;
|
||||
return $this->cache;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Model for XML generation.
|
||||
*
|
||||
* @param \App\Dataset $model Model to serialize.
|
||||
* @param \App\Models\Dataset $model Model to serialize.
|
||||
*
|
||||
* @return XmlModel Fluent interface.
|
||||
*/
|
||||
public function setModel($model)
|
||||
{
|
||||
$this->_config->model = $model;
|
||||
$this->config->model = $model;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ class XmlModel
|
|||
*/
|
||||
public function excludeEmptyFields()
|
||||
{
|
||||
$this->_config->excludeEmpty = true;
|
||||
$this->config->excludeEmpty = true;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ class XmlModel
|
|||
*/
|
||||
public function getDomDocument()
|
||||
{
|
||||
$dataset = $this->_config->model;
|
||||
$dataset = $this->config->model;
|
||||
|
||||
$domDocument = $this->getDomDocumentFromXmlCache();
|
||||
if (!is_null($domDocument)) {
|
||||
|
@ -127,19 +127,19 @@ class XmlModel
|
|||
}
|
||||
|
||||
//create xml:
|
||||
$domDocument = $this->_strategy->getDomDocument();
|
||||
$domDocument = $this->strategy->getDomDocument();
|
||||
//if caching is not desired, return domDocument
|
||||
if (is_null($this->_cache)) {
|
||||
if (is_null($this->cache)) {
|
||||
return $domDocument;
|
||||
} else {
|
||||
//create cache relation
|
||||
$this->_cache->fill(array(
|
||||
$this->cache->fill(array(
|
||||
'document_id' => $dataset->id,
|
||||
'xml_version' => (int)$this->_strategy->getVersion(),
|
||||
'xml_version' => (int)$this->strategy->getVersion(),
|
||||
'server_date_modified' => $dataset->server_date_modified,
|
||||
'xml_data' => $domDocument->saveXML()
|
||||
));
|
||||
$this->_cache->save();
|
||||
$this->cache->save();
|
||||
|
||||
Log::debug(__METHOD__ . ' cache refreshed for ' . get_class($dataset) . '#' . $dataset->id);
|
||||
return $domDocument;
|
||||
|
@ -155,15 +155,15 @@ class XmlModel
|
|||
*/
|
||||
private function getDomDocumentFromXmlCache()
|
||||
{
|
||||
$dataset = $this->_config->model;
|
||||
if (null === $this->_cache) {
|
||||
$dataset = $this->config->model;
|
||||
if (null === $this->cache) {
|
||||
//$logger->debug(__METHOD__ . ' skipping cache for ' . get_class($model));
|
||||
Log::debug(__METHOD__ . ' skipping cache for ' . get_class($dataset));
|
||||
return null;
|
||||
}
|
||||
//$cached = $this->_cache->hasValidEntry(
|
||||
//$cached = $this->cache->hasValidEntry(
|
||||
// $dataset->id,
|
||||
// (int) $this->_strategy->getVersion(),
|
||||
// (int) $this->strategy->getVersion(),
|
||||
// $dataset->server_date_modified
|
||||
//);
|
||||
|
||||
|
|
15
app/Models/Collection.php
Normal file
15
app/Models/Collection.php
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\Dataset;
|
||||
|
||||
class Collection extends Model
|
||||
{
|
||||
|
||||
public function documents()
|
||||
{
|
||||
return $this->belongsToMany(Dataset::class, 'link_documents_collections', 'collection_id', 'document_id');
|
||||
}
|
||||
}
|
|
@ -1,10 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
namespace App\Models;
|
||||
|
||||
use App\Library\Xml\DatasetExtension;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\Collection;
|
||||
use App\Models\License;
|
||||
use App\Models\Project;
|
||||
use App\Models\Title;
|
||||
use App\Models\Person;
|
||||
use App\Models\XmlCache;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Dataset extends Model
|
||||
{
|
||||
|
@ -23,7 +28,7 @@ class Dataset extends Model
|
|||
'creating_corporation',
|
||||
'project_id',
|
||||
'embargo_date',
|
||||
'belongs_to_bibliography'
|
||||
'belongs_to_bibliography',
|
||||
];
|
||||
/**
|
||||
* The attributes that should be mutated to dates.
|
||||
|
@ -44,17 +49,17 @@ class Dataset extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the project that the product belongs to.
|
||||
* Get the project that the dataset belongs to.
|
||||
*/
|
||||
public function project()
|
||||
{
|
||||
return $this->belongsTo(\App\Project::class, 'project_id', 'id');
|
||||
return $this->belongsTo(Project::class, 'project_id', 'id');
|
||||
}
|
||||
|
||||
public function collections()
|
||||
{
|
||||
return $this
|
||||
->belongsToMany(\App\Collection::class, 'link_documents_collections', 'document_id', 'collection_id');
|
||||
->belongsToMany(Collection::class, 'link_documents_collections', 'document_id', 'collection_id');
|
||||
}
|
||||
|
||||
#region [person table]
|
||||
|
@ -62,7 +67,7 @@ class Dataset extends Model
|
|||
//return all persons attached to this film
|
||||
public function persons()
|
||||
{
|
||||
return $this->belongsToMany(\App\Person::class, 'link_documents_persons', 'document_id', 'person_id')
|
||||
return $this->belongsToMany(Person::class, 'link_documents_persons', 'document_id', 'person_id')
|
||||
->withPivot('role');
|
||||
}
|
||||
|
||||
|
@ -74,18 +79,18 @@ class Dataset extends Model
|
|||
public function authors()
|
||||
{
|
||||
return $this
|
||||
->belongsToMany(\App\Person::class, 'link_documents_persons', 'document_id', 'person_id')
|
||||
->belongsToMany(Person::class, 'link_documents_persons', 'document_id', 'person_id')
|
||||
->wherePivot('role', 'author');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add author to dataset
|
||||
*
|
||||
* @param \App\User $user user to add
|
||||
* @param Person $user user to add
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addAuthor(\App\User $user): void
|
||||
public function addAuthor(Person $user): void
|
||||
{
|
||||
$this->persons()->save($user, ['role' => 'author']);
|
||||
}
|
||||
|
@ -98,7 +103,7 @@ class Dataset extends Model
|
|||
public function contributors()
|
||||
{
|
||||
return $this
|
||||
->belongsToMany(\App\Person::class, 'link_documents_persons', 'document_id', 'person_id')
|
||||
->belongsToMany(Person::class, 'link_documents_persons', 'document_id', 'person_id')
|
||||
->wherePivot('role', 'contributor');
|
||||
}
|
||||
|
||||
|
@ -143,7 +148,7 @@ class Dataset extends Model
|
|||
|
||||
public function licenses()
|
||||
{
|
||||
return $this->belongsToMany(\App\License::class, 'link_documents_licences', 'document_id', 'licence_id');
|
||||
return $this->belongsToMany(License::class, 'link_documents_licences', 'document_id', 'licence_id');
|
||||
}
|
||||
|
||||
public function files()
|
||||
|
@ -154,11 +159,11 @@ class Dataset extends Model
|
|||
/**
|
||||
* Get the xml-cache record associated with the dataset.
|
||||
*
|
||||
* @return \App\XmlCache
|
||||
* @return \App\Models\XmlCache
|
||||
*/
|
||||
public function xmlCache()
|
||||
{
|
||||
return $this->hasOne(\App\XmlCache::class, 'document_id', 'id');
|
||||
return $this->hasOne(XmlCache::class, 'document_id', 'id');
|
||||
}
|
||||
|
||||
public function scopeOrderByType($query)
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
namespace App;
|
||||
namespace App\Models;
|
||||
|
||||
use App\Dataset;
|
||||
use App\Models\Dataset;
|
||||
|
||||
/**
|
||||
* DocumentFinder short summary.
|
||||
|
@ -16,7 +16,7 @@ class DatasetFinder
|
|||
/**
|
||||
* @var \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
private $_select = null;
|
||||
private $select = null;
|
||||
/**
|
||||
* Create new instance of Opus_DocumentList class. The created object
|
||||
* allows to get custom subsets (or lists) of all existing Opus_Documents.
|
||||
|
@ -26,9 +26,9 @@ class DatasetFinder
|
|||
// $table = Opus_Db_TableGateway::getInstance(self::$_tableGatewayClass);
|
||||
|
||||
// $this->_db = $table->getAdapter();
|
||||
// $this->_select = $this->_db->select()->from(array('d' => 'documents'));
|
||||
// $this->select = $this->_db->select()->from(array('d' => 'documents'));
|
||||
|
||||
$this->_select = Dataset::query(); //>select('name', 'email as user_email')
|
||||
$this->select = Dataset::query(); //>select('name', 'email as user_email')
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -39,8 +39,8 @@ class DatasetFinder
|
|||
*/
|
||||
public function setServerStateInList($serverStateArray)
|
||||
{
|
||||
$this->_select->whereIn('server_state', $serverStateArray);
|
||||
//$this->_select->where('server_state IN (?)', $serverStateArray);
|
||||
$this->select->whereIn('server_state', $serverStateArray);
|
||||
//$this->select->where('server_state IN (?)', $serverStateArray);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ class DatasetFinder
|
|||
*/
|
||||
public function setType($type)
|
||||
{
|
||||
$this->_select->where('type', $type);
|
||||
$this->select->where('type', $type);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -64,8 +64,8 @@ class DatasetFinder
|
|||
*/
|
||||
public function setServerState($serverState)
|
||||
{
|
||||
//$this->_select->where('server_state', '=', $serverState);
|
||||
$this->_select->where('server_state', 'LIKE', "%".$serverState."%");
|
||||
//$this->select->where('server_state', '=', $serverState);
|
||||
$this->select->where('server_state', 'LIKE', "%".$serverState."%");
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -76,8 +76,8 @@ class DatasetFinder
|
|||
*/
|
||||
public function groupedTypesPlusCount()
|
||||
{
|
||||
//$this->_select->reset('columns');
|
||||
$test = $this->_select
|
||||
//$this->select->reset('columns');
|
||||
$test = $this->select
|
||||
//->select("type") // "count(DISTINCT id)");
|
||||
->selectRaw('type, count(DISTINCT id) as count')
|
||||
->groupBy('type')
|
||||
|
@ -93,7 +93,7 @@ class DatasetFinder
|
|||
*/
|
||||
public function count()
|
||||
{
|
||||
$this->_select->count();
|
||||
$this->select->count();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -107,6 +107,6 @@ class DatasetFinder
|
|||
public function ids()
|
||||
{
|
||||
//return array_unique($this->_db->fetchCol($this->getSelectIds()));
|
||||
return $this->_select->pluck('id')->toArray();
|
||||
return $this->select->pluck('id')->toArray();
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Dataset;
|
||||
use App\Models\Dataset;
|
||||
use App\Models\HashValue;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace App;
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
<?php
|
||||
namespace App;
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\Dataset;
|
||||
|
||||
class License extends Model
|
||||
{
|
||||
|
@ -19,11 +20,11 @@ class License extends Model
|
|||
'mime_type',
|
||||
'name_long',
|
||||
'pod_allowed',
|
||||
'sort_order'
|
||||
'sort_order',
|
||||
];
|
||||
|
||||
public function datasets()
|
||||
{
|
||||
return $this->belongsToMany(\App\Dataset::class, 'link_documents_licences', 'licence_id', 'document_id');
|
||||
return $this->belongsToMany(Dataset::class, 'link_documents_licences', 'licence_id', 'document_id');
|
||||
}
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\User;
|
||||
use App\Models\User;
|
||||
use App\Models\ModelTrait;
|
||||
|
||||
class Page extends Model
|
||||
|
@ -62,7 +62,8 @@ class Page extends Model
|
|||
*/
|
||||
public function getViewButtonAttribute()
|
||||
{
|
||||
return '<a target="_blank" href="'. route('frontend.pages.show', $this->page_slug) .'" class="btn btn-flat btn-default">
|
||||
return '<a target="_blank" href="
|
||||
'. route('frontend.pages.show', $this->page_slug) .' " class="btn btn-flat btn-default">
|
||||
<i data-toggle="tooltip" data-placement="top" title="View Page" class="fa fa-eye"></i>
|
||||
</a>';
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
namespace App;
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Dataset;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Person extends Model
|
||||
|
@ -12,28 +13,29 @@ class Person extends Model
|
|||
'first_name',
|
||||
'email',
|
||||
'identifier_orcid',
|
||||
'status'
|
||||
'status',
|
||||
];
|
||||
protected $table = 'persons';
|
||||
public $timestamps = false;
|
||||
protected $appends = ['full_name'];
|
||||
|
||||
public function documents()
|
||||
{
|
||||
return $this->belongsToMany(\App\Dataset::class, 'link_documents_persons', 'person_id', 'document_id')
|
||||
return $this->belongsToMany(Dataset::class, 'link_documents_persons', 'person_id', 'document_id')
|
||||
->withPivot('role');
|
||||
}
|
||||
|
||||
|
||||
// public function scopeNotLimit($query)
|
||||
// {
|
||||
// return $query->where('borrow', '<', 3);
|
||||
// }
|
||||
|
||||
/**
|
||||
* Get the user's full name.
|
||||
*
|
||||
* see https://laravel.com/docs/5.6/eloquent-serialization
|
||||
* @return string
|
||||
*/
|
||||
public function getFullName()
|
||||
public function getFullNameAttribute()
|
||||
{
|
||||
return $this->first_name . " " . $this->last_name;
|
||||
}
|
|
@ -1,7 +1,8 @@
|
|||
<?php
|
||||
namespace App;
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\Dataset;
|
||||
|
||||
class Project extends Model
|
||||
{
|
||||
|
@ -18,7 +19,7 @@ class Project extends Model
|
|||
public function documents()
|
||||
{
|
||||
//model, foreign key on the Document model is project_id, local id of category
|
||||
return $this->hasMany(\App\Dataset::class, 'project_id', 'id');
|
||||
return $this->hasMany(Dataset::class, 'project_id', 'id');
|
||||
}
|
||||
|
||||
// public function books()
|
|
@ -4,6 +4,7 @@ namespace App\Models;
|
|||
//use App\Library\Xml\DatasetExtension;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\Dataset;
|
||||
|
||||
class Title extends Model
|
||||
{
|
||||
|
@ -16,6 +17,6 @@ class Title extends Model
|
|||
|
||||
public function dataset()
|
||||
{
|
||||
return $this->belongsTo(\App\Dataset::class, 'document_id', 'id');
|
||||
return $this->belongsTo(Dataset::class, 'document_id', 'id');
|
||||
}
|
||||
}
|
||||
|
|
2
app/User.php → app/Models/User.php
Executable file → Normal file
2
app/User.php → app/Models/User.php
Executable file → Normal file
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace App;
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Notifications\Notifiable;
|
|
@ -1,8 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\Dataset;
|
||||
|
||||
class XmlCache extends Model
|
||||
{
|
||||
|
@ -36,7 +37,7 @@ class XmlCache extends Model
|
|||
*/
|
||||
public function dataset()
|
||||
{
|
||||
return $this->belongsTo(\App\Dataset::class, 'document_id', 'id');
|
||||
return $this->belongsTo(Dataset::class, 'document_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
namespace App\Services;
|
||||
|
||||
use App\User;
|
||||
use App\Models\User;
|
||||
use Validator;
|
||||
use Illuminate\Contracts\Auth\Registrar as RegistrarContract;
|
||||
|
||||
|
|
|
@ -27,8 +27,7 @@
|
|||
"autoload": {
|
||||
"classmap": [
|
||||
"database/seeds",
|
||||
"database/factories",
|
||||
"database"
|
||||
"database/factories"
|
||||
],
|
||||
"psr-4": {
|
||||
"App\\": "app/"
|
||||
|
@ -65,6 +64,7 @@
|
|||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
"homepage": "https://www.geologie.ac.at/"
|
||||
}
|
||||
|
|
14
composer.lock
generated
14
composer.lock
generated
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "45de841e5697551ae24e4065b9afb6c4",
|
||||
"content-hash": "01c12d1633f3bbbb6ddbff87d4516b4f",
|
||||
"packages": [
|
||||
{
|
||||
"name": "davejamesmiller/laravel-breadcrumbs",
|
||||
|
@ -3409,16 +3409,16 @@
|
|||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
"version": "6.5.12",
|
||||
"version": "6.5.13",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "24da433d7384824d65ea93fbb462e2f31bbb494e"
|
||||
"reference": "0973426fb012359b2f18d3bd1e90ef1172839693"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/24da433d7384824d65ea93fbb462e2f31bbb494e",
|
||||
"reference": "24da433d7384824d65ea93fbb462e2f31bbb494e",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0973426fb012359b2f18d3bd1e90ef1172839693",
|
||||
"reference": "0973426fb012359b2f18d3bd1e90ef1172839693",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -3489,7 +3489,7 @@
|
|||
"testing",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2018-08-22T06:32:48+00:00"
|
||||
"time": "2018-09-08T15:10:43+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit-mock-objects",
|
||||
|
@ -4252,7 +4252,7 @@
|
|||
}
|
||||
],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"minimum-stability": "dev",
|
||||
"stability-flags": [],
|
||||
"prefer-stable": true,
|
||||
"prefer-lowest": false,
|
||||
|
|
|
@ -67,7 +67,7 @@ return [
|
|||
'providers' => [
|
||||
'users' => [
|
||||
'driver' => 'eloquent',
|
||||
'model' => App\User::class,
|
||||
'model' => App\Models\User::class,
|
||||
],
|
||||
|
||||
// 'users' => [
|
||||
|
|
|
@ -51,7 +51,7 @@ return [
|
|||
| Update the User if it is in a different namespace.
|
||||
|
|
||||
*/
|
||||
'user' => 'App\User',
|
||||
'user' => 'App\Models\User',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
@ -30,7 +30,7 @@ return [
|
|||
],
|
||||
|
||||
'stripe' => [
|
||||
'model' => 'App\User',
|
||||
'model' => 'App\Models\User',
|
||||
'secret' => '',
|
||||
],
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,9 +1,10 @@
|
|||
// MyVuetable.vue
|
||||
|
||||
<!-- :fields="['name', 'email', 'birthdate']" -->
|
||||
// "https://vuetable.ratiw.net/api/users"
|
||||
<template>
|
||||
<vuetable ref="vuetable"
|
||||
api-url="https://vuetable.ratiw.net/api/users"
|
||||
:fields="['name', 'email', 'birthdate']"
|
||||
api-url="/api/persons"
|
||||
v-bind:fields="fields" pagination-path=""
|
||||
></vuetable>
|
||||
</template>
|
||||
|
||||
|
@ -13,6 +14,61 @@ import Vuetable from "vuetable-2/src/components/Vuetable";
|
|||
export default {
|
||||
components: {
|
||||
Vuetable
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
fields: [
|
||||
{
|
||||
name: "full_name",
|
||||
// sortField: "name"
|
||||
},
|
||||
{
|
||||
name: "email",
|
||||
// sortField: "email"
|
||||
},
|
||||
{
|
||||
name: "date_of_birth",
|
||||
// sortField: "birthdate",
|
||||
// titleClass: "text-center",
|
||||
// dataClass: "text-center",
|
||||
// callback: "formatDate|DD-MM-YYYY"
|
||||
},
|
||||
{
|
||||
name: "__component:custom-actions",
|
||||
title: "Actions",
|
||||
titleClass: "text-center",
|
||||
dataClass: "text-center"
|
||||
}
|
||||
],
|
||||
css: {
|
||||
table: {
|
||||
tableClass: "table table-bordered table-striped table-hover",
|
||||
ascendingIcon: "glyphicon glyphicon-chevron-up",
|
||||
descendingIcon: "glyphicon glyphicon-chevron-down"
|
||||
},
|
||||
pagination: {
|
||||
wrapperClass: "pagination",
|
||||
activeClass: "active",
|
||||
disabledClass: "disabled",
|
||||
pageClass: "page",
|
||||
linkClass: "link",
|
||||
icons: {
|
||||
first: "",
|
||||
prev: "",
|
||||
next: "",
|
||||
last: ""
|
||||
}
|
||||
},
|
||||
icons: {
|
||||
first: "glyphicon glyphicon-step-backward",
|
||||
prev: "glyphicon glyphicon-chevron-left",
|
||||
next: "glyphicon glyphicon-chevron-right",
|
||||
last: "glyphicon glyphicon-step-forward"
|
||||
}
|
||||
},
|
||||
sortOrder: [{ field: "email", sortField: "email", direction: "asc" }],
|
||||
moreParams: {}
|
||||
};
|
||||
}
|
||||
};
|
||||
</script>
|
|
@ -4,7 +4,7 @@ return [
|
|||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Pagination Language Lines
|
||||
| Doctypes Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following language lines are used by the paginator library to build
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
@section('content')
|
||||
<div class="header">
|
||||
<h3 class="header-title">
|
||||
Edit {{ $person->getFullName() }}
|
||||
Edit {{ $person->full_name }}
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use App\Models\Person;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -19,3 +20,44 @@ Route::middleware('auth:api')->get('/user', function (Request $request) {
|
|||
});
|
||||
|
||||
Route::get('/oai', 'Oai\RequestController@identify');
|
||||
|
||||
Route::get('/api/persons', function () {
|
||||
$request = request();
|
||||
$query = Person::query();//->with('group');
|
||||
// handle sort option
|
||||
//if (request()->has('sort')) {
|
||||
if (null !== ($request->input('sort'))) {
|
||||
// handle multisort
|
||||
$sorts = explode(',', request()->sort);
|
||||
foreach ($sorts as $sort) {
|
||||
list($sortCol, $sortDir) = explode('|', $sort);
|
||||
$query = $query->orderBy($sortCol, $sortDir);
|
||||
}
|
||||
} else {
|
||||
$query = $query->orderBy('id', 'asc');
|
||||
}
|
||||
if ($request->exists('filter')) {
|
||||
$query->where(function ($q) use ($request) {
|
||||
$value = "%{$request->filter}%";
|
||||
$q->where('name', 'like', $value)
|
||||
// ->orWhere('nickname', 'like', $value)
|
||||
->orWhere('email', 'like', $value);
|
||||
});
|
||||
}
|
||||
$perPage = request()->has('per_page') ? (int) request()->per_page : null;
|
||||
// $pagination = $query->with('address')->paginate($perPage);
|
||||
$pagination = $query->paginate($perPage);
|
||||
$pagination->appends([
|
||||
'sort' => request()->sort,
|
||||
'filter' => request()->filter,
|
||||
'per_page' => request()->per_page
|
||||
]);
|
||||
// The headers 'Access-Control-Allow-Origin' and 'Access-Control-Allow-Methods'
|
||||
// are to allow you to call this from any domain (see CORS for more info).
|
||||
// This is for local testing only. You should not do this in production server,
|
||||
// unless you know what it means.
|
||||
return response()
|
||||
->json($pagination)
|
||||
->header('Access-Control-Allow-Origin', '*')
|
||||
->header('Access-Control-Allow-Methods', 'GET');
|
||||
});
|
||||
|
|
|
@ -16,6 +16,7 @@ use Illuminate\Support\Facades\Route;
|
|||
|
||||
Route::get('/oai', ['as' => 'oai', 'uses' => 'Oai\RequestController@index']);
|
||||
|
||||
//=================================================publish dataasets================================================
|
||||
Route::group(
|
||||
[
|
||||
'namespace' => 'Publish',
|
||||
|
@ -197,6 +198,9 @@ Route::group(['middleware' => ['permission:settings']], function () {
|
|||
*/
|
||||
Route::group(['namespace' => 'Frontend', 'as' => 'frontend.'], function () {
|
||||
// includeRouteFiles(__DIR__.'/Frontend/');
|
||||
Route::get('/test', [
|
||||
'as' => 'home.index', 'uses' => 'HomeController@test',
|
||||
]);
|
||||
Route::get('/', [
|
||||
'as' => 'home.index', 'uses' => 'HomeController@index',
|
||||
]);
|
||||
|
@ -217,7 +221,7 @@ Route::group(['namespace' => 'Frontend', 'as' => 'frontend.'], function () {
|
|||
Route::get('sitelinks', [
|
||||
'as' => 'sitelinks.index', 'uses' => 'SitelinkController@index',
|
||||
]);
|
||||
Route::get('sitelinks/list/{year}', 'SitelinkController@list')->name('sitelinks.list');
|
||||
Route::get('sitelinks/list/{year}', 'SitelinkController@listDocs')->name('sitelinks.list');
|
||||
|
||||
Route::get('/dataset', [
|
||||
'as' => 'datasets', 'uses' => 'PagesController@datasets',
|
||||
|
|
Loading…
Reference in New Issue
Block a user