I have this piece of legacy code to return all events to the front end:
/**
* @param $request
*
* @return mixed
*/
public function index( EventsFilterRequest $request ) {
$keys = $request->all();
if ( \count( $keys ) === 0 ) {
return $this->eventsQueryBuilder()->isVisibleFor( authUser()->id )->ofOrder( 'starts_at', 'ASC' )->ofCountry( runtime()->country()->id )->ofStatus( 'future' );
}
$events = $this->eventsQueryBuilder()->isVisibleFor( authUser()->id )->ofOrder( 'starts_at', 'ASC' )->ofStatus( 'future' )->ofCountry( runtime()->country()->id );
foreach ( $keys as $key => $value ) {
if ( array_key_exists( $key, $this->_methods ) ) {
$events = $this->_methods[$key]( $events, $request, $this );
}
}
return $events;
}
In the events
table there's a column called privacy
that contains public
or private
. How can I exclude private events from being returned ?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire