projecten

This commit is contained in:
2018-01-23 08:45:44 +01:00
parent 970aa53971
commit fb19c401fd
36 changed files with 1402 additions and 184 deletions
+22 -3
View File
@@ -68,7 +68,7 @@ class Project extends BaseModel {
'offers' => function ( $q ) {
$q->whereArchive( 'F' )
->with( [
'payment' => function ( $q ) {
'payments' => function ( $q ) {
$q->selectRaw( '*' );
}] );
}] )
@@ -76,6 +76,7 @@ class Project extends BaseModel {
'projectemployees.user' => function ( $q ) {
$q->selectRaw( "id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" );
}] )
->with( 'projectemployees.projecthours' )
->with( 'customer' );
return $project;
@@ -83,10 +84,28 @@ class Project extends BaseModel {
public static function createProject()
{
$data = ['startdate'=> date('Y-m-d')];
$data = ['startdate' => date( 'Y-m-d' )];
$project = Project::create($data);
$project = Project::create( $data );
return $project->id;
}
public static function saveProject( $projectID, $project )
{
$project = (array) $project;
if ( $projectID == 0 )
{
$project = Project::create( $project );
$projectID = $project['id'];;
}
else
{
Project::whereId( $projectID )->update( $project );
}
return $projectID;
}
}