save employeehours with uuid

This commit is contained in:
2022-02-01 15:57:17 +01:00
parent 32fb520739
commit a43450556d
7 changed files with 91 additions and 73 deletions
+6 -5
View File
@@ -41,19 +41,20 @@ class Employeehour extends BaseModel {
return $results;
}
public static function saveEmployeehour( $employeehourID, $data )
public static function saveEmployeehour( $data )
{
if ( $employeehourID == 0 )
$record = Employeehour::whereUuid( $data['uuid'])->first();
if ( ! $record )
{
$employeehour = Employeehour::create( $data );
$employeehourID = $employeehour->id;
}
else
{
Employeehour::whereId( $employeehourID )->update( $data );
Employeehour::whereUuid( $data['uuid'] )->update( $data );
$employeehourID = FALSE;
}
return $employeehourID;
}
}
}