38 lines
742 B
PHP
38 lines
742 B
PHP
<?php
|
|
/**
|
|
* Created by Pensare Software.
|
|
* User: Theo Weijmer
|
|
* Date: 07/03/2018
|
|
* Time: 09:24
|
|
*/
|
|
|
|
class Forecast extends BaseModel {
|
|
|
|
public function project()
|
|
{
|
|
return $this->belongsTo( 'Project' );
|
|
}
|
|
|
|
public static function saveForecast( $forecastID, $forecast )
|
|
{
|
|
$forecast = (array) $forecast;
|
|
|
|
if ( $forecastID == 0 )
|
|
{
|
|
$forecast = self::create( $forecast );
|
|
$forecastID = $forecast['id'];
|
|
}
|
|
else
|
|
{
|
|
self::whereId( $forecastID )->update( $forecast );
|
|
}
|
|
|
|
return $forecastID;
|
|
}
|
|
|
|
public static function removeForecast( $forecastID )
|
|
{
|
|
Forecast::whereId( $forecastID )->delete();
|
|
}
|
|
|
|
} |