43 lines
887 B
PHP
43 lines
887 B
PHP
<?php
|
|
/**
|
|
* Created by Pensare Software.
|
|
* User: Theo Weijmer
|
|
* Date: 07/03/2018
|
|
* Time: 09:24
|
|
*/
|
|
|
|
class Reservation extends BaseModel {
|
|
|
|
public function project()
|
|
{
|
|
return $this->belongsTo( 'Project' );
|
|
}
|
|
|
|
public function external()
|
|
{
|
|
return $this->belongsTo( 'External' );
|
|
}
|
|
|
|
public static function saveReservation( $reservationID, $reservation )
|
|
{
|
|
$reservation = (array) $reservation;
|
|
|
|
if ( $reservationID == 0 )
|
|
{
|
|
$reservation = self::create( $reservation );
|
|
$reservationID = $reservation['id'];
|
|
}
|
|
else
|
|
{
|
|
self::whereId( $reservationID )->update( $reservation );
|
|
}
|
|
|
|
return $reservationID;
|
|
}
|
|
|
|
public static function removeReservation( $reservationID )
|
|
{
|
|
Reservation::whereId( $reservationID )->delete();
|
|
}
|
|
|
|
} |