17 use Illuminate\Database\Capsule\Manager as Capsule;
71 ->select(
'a.announcement_id')
82 ->select(
'a.announcement_id')
83 ->pluck(
'a.announcement_id')
93 $this->columns = [
'a.*'];
94 $q = Capsule::table(
'announcements as a');
96 if (!empty($this->contextIds)) {
97 $q->whereIn(
'a.assoc_id', $this->contextIds);
100 if (!empty($this->typeIds)) {
101 $q->whereIn(
'a.type_id', $this->typeIds);
108 $q->leftJoin(
'announcement_settings as as',
'a.announcement_id',
'=',
'as.announcement_id');
109 foreach ($words as $word) {
110 $word = strtolower(addcslashes($word,
'%_'));
111 $q->where(
function($q) use ($word) {
112 $q->where(
function($q) use ($word) {
113 $q->where(
'as.setting_name',
'title');
114 $q->where(Capsule::raw(
'lower(as.setting_value)'),
'LIKE',
"%{$word}%");
116 ->orWhere(
function($q) use ($word) {
117 $q->where(
'as.setting_name',
'descriptionShort');
118 $q->where(Capsule::raw(
'lower(as.setting_value)'),
'LIKE',
"%{$word}%");
120 ->orWhere(
function($q) use ($word) {
121 $q->where(
'as.setting_name',
'description');
122 $q->where(Capsule::raw(
'lower(as.setting_value)'),
'LIKE',
"%{$word}%");
129 $q->orderBy(
'a.date_posted',
'desc');
130 $q->groupBy(
'a.announcement_id');
135 $q->select($this->columns);