Exemple #1
0
 /**
  * Get published items
  * 
  * @return array
  */
 static function getPublishedItems()
 {
     $items = Content::orWhere(function ($query) {
         $query->where('publish_start', '<', date('Y-m-d'));
         $query->where('publish_end', '<', date('Y-m-d'));
     })->orWhere(function ($query) {
         $query->where('publish_start', '<', date('Y-m-d'));
         $query->whereNull('publish_end');
     })->orWhere(function ($query) {
         $query->whereNull('publish_start');
         $query->where('publish_end', '>', date('Y-m-d'));
     })->get();
     return $items;
 }