Wijzigingen nav opmerking Peter 24-12-2018

This commit is contained in:
2019-01-02 16:57:41 +01:00
parent 9569522c83
commit efcd9f2c09
19 changed files with 201 additions and 44 deletions
+7 -4
View File
@@ -26,15 +26,18 @@ class Offer extends BaseModel {
return $this->belongsTo( 'Customer' );
}
public static function getAllOffers( $projectID, $archive = 'F' )
public static function getAllOffers( $projectID, $archive = 'F', $search, $order, $direction )
{
$offers = Offer::orderBy( 'startdate' )
$offers = Offer::selectRAW('offers.*')
->join('customers AS CUS', 'CUS.id', '=', 'offers.customer_id')
->with( 'customer' )
->with( 'project' );
->with( 'project' )
->where('offernumber', 'LIKE', "%{$search}%")
->orderBy($order, $direction);
if ( $projectID ) $offers = $offers->whereProjectId( $projectID );
if ( $archive == 'F' ) $offers = $offers->whereArchive( 'F' );
if ( $archive == 'F' ) $offers = $offers->where( 'offers.archive', '=', 'F' );
$offers = $offers->get();