This commit is contained in:
2018-01-25 21:49:30 +01:00
parent fb19c401fd
commit bc0bd51801
16 changed files with 623 additions and 219 deletions
+14 -5
View File
@@ -21,6 +21,16 @@ class Project extends BaseModel {
return $this->hasMany( 'Projectemployee' );
}
public function projectcosts()
{
return $this->hasMany( 'Projectcost' );
}
public function invoices()
{
return $this->hasMany( 'Invoice' );
}
public function projectleader()
{
return $this->belongsTo( 'User', 'projectleader_id' );
@@ -66,17 +76,16 @@ class Project extends BaseModel {
}] )
->with( [
'offers' => function ( $q ) {
$q->whereArchive( 'F' )
->with( [
'payments' => function ( $q ) {
$q->selectRaw( '*' );
}] );
$q->whereArchive( 'F' );
}] )
->with( [
'projectemployees.user' => function ( $q ) {
$q->selectRaw( "id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" );
}] )
->with( 'projectemployees.projecthours' )
->with( 'projectcosts.external' )
->with( 'invoices.payments' )
->with( 'invoices.vat' )
->with( 'customer' );
return $project;