Make scheduled statuses work under PgSQL and existing installations

This commit is contained in:
James Brooks
2015-02-28 21:50:50 +00:00
parent 92c43318a8
commit 6bf5ad2328
4 changed files with 42 additions and 7 deletions

View File

@@ -81,7 +81,7 @@ class Incident extends Model implements TransformableInterface, PresenterInterfa
public function scopeNotScheduled($query)
{
return $query->where(function ($query) {
return $query->where('scheduled_at', '0000-00-00 00:00:00')->orWhereRaw('scheduled_at <= NOW()');
return $query->whereNull('scheduled_at')->orWhereRaw('scheduled_at <= NOW()');
});
}
@@ -124,7 +124,7 @@ class Incident extends Model implements TransformableInterface, PresenterInterfa
*/
public function getIsScheduledAttribute()
{
return $this->getOriginal('scheduled_at') != '0000-00-00 00:00:00';
return $this->getOriginal('scheduled_at');
}
/**