/** * Scope "today" * * @param mixed $query * @return mixed */ public function scopeToday($query) { $sql = 'date(created_at) = date(now())'; if (db_is('sqlite')) { $sql = "date(created_at) = date('now')"; } return $query->whereRaw($sql); }
/** * @param $query * @return mixed */ public function scopeToday($query) { // mysql $raw = "date(created_at) = date(now())"; if (db_is('sqlite')) { $raw = "date(created_at) = date(date('now'))"; } return $query->whereRaw($raw); }