Exemplo n.º 1
0
 /**
  * Determines if the instance is between two others
  *
  * @param  Carbon  $dt1
  * @param  Carbon  $dt2
  * @param  boolean $equal  Indicates if a > and < comparison should be used or <= or >=
  *
  * @return boolean
  */
 public function between(Carbon $dt1, Carbon $dt2, $equal = true)
 {
     if ($dt1->gt($dt2)) {
         $temp = $dt1;
         $dt1 = $dt2;
         $dt2 = $temp;
     }
     if ($equal) {
         return $this->gte($dt1) && $this->lte($dt2);
     } else {
         return $this->gt($dt1) && $this->lt($dt2);
     }
 }
Exemplo n.º 2
0
 public function isRecentArticle()
 {
     $date = new Carbon($this->data['date']);
     $date->addDays(ARTICLE_RECENT_DAY);
     return $date->gt(Carbon::now());
 }