public function getSearch(Request $req) { if (!$_GET) { return redirect()->action('SiteController@getIndex'); } $query = $req->input('q', ''); $paid = $req->input('paid', 0); $place = $req->input('place', ''); $all_types = EventType::toTransList(); $types = $req->input('types', []); $ilikey = function (string $str) { return strtr(" {$str} ", ' ', '%'); }; /** @var Builder $db_query */ $db_query = Event::where('hidden', 0); if ($query) { $db_query->where('title', 'ilike', $ilikey($query)); } //FIXME: improve this text search if ($paid) { $db_query->where('free', $paid == -1); } if ($place) { $db_query->where('location', 'ilike', $ilikey($place)); } if ($types) { $db_query->whereIn('event_type_id', $types); } $events = $db_query->get(); if (sizeof($events) == 1 && $query) { return redirect()->to(act('event@details', $events[0]->slug)); } return view('event.search', compact('query', 'paid', 'place', 'all_types', 'types', 'events')); }
public function getEvents(string $id_slug, Request $req) { $id = unslug($id_slug)[0]; $paid = $req->input('paid', 0); $theme = Theme::with('events')->find($id); $types = \App\Models\EventType::toTransList(); return view('theme.events', compact('theme', 'paid', 'types')); }
} ?> <?php if ($showField('location')) { ?> <?php echo Form::labelInput('location', _('City'), 'text'); } ?> <?php if ($showField('event_type_id')) { ?> <?php echo Form::labelSelect('event_type_id', _('Event type'), EventType::toTransList(_('Select an option'))); } ?> <?php if ($showField('begin')) { ?> <?php echo Form::labelInput('begin', _('Begin'), 'date', $event->begin ? $event->begin->format('Y-m-d') : null); } ?> <?php if ($showField('end')) { ?> <?php