offer fileupload and comments
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?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, $tablename )
|
||||
{
|
||||
$documents = Document::orderBy( 'uploaddate', 'desc' )
|
||||
->with( [
|
||||
'user' => function ( $q ) {
|
||||
$q->selectRaw( "CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname, id" );
|
||||
}] )
|
||||
->whereForeignId( $foreignID )
|
||||
->whereForeignTable( $tablename )
|
||||
->get();
|
||||
|
||||
return $documents;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user