32 lines
677 B
PHP
32 lines
677 B
PHP
<?php
|
|
/**
|
|
* Created by Pensare Software.
|
|
* User: Theo Weijmer
|
|
* Date: 10/01/2018
|
|
* Time: 20:02
|
|
*/
|
|
|
|
class Document extends BaseModel {
|
|
|
|
protected $table = "documents";
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo( 'User' );
|
|
}
|
|
|
|
public static function getDocuments( $foreignID)
|
|
{
|
|
$documents = Document::orderBy( 'uploaddate', 'desc' )
|
|
->with( [
|
|
'user' => function ( $q ) {
|
|
$q->selectRaw( "CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname, id" );
|
|
}] )
|
|
->whereForeignId( $foreignID )
|
|
->get();
|
|
|
|
return $documents;
|
|
}
|
|
|
|
|
|
} |