/** * Return the favorites of a certain model or table, leave the data as is under $model->settings['favorites'] * * @param $model * @param $data * * @return object|false */ static function getFavoritesByModel($model, $data) { if (!isset($data[$model])) { return false; } $data = array_keys($data[$model]); switch ($model) { case 'articles': return Article::whereIn('id', $data)->get(); case 'sites': return Site::whereIn('id', $data)->get(); case 'professions': return Profession::whereIn('id', $data)->get(); case 'classifieds': return Classified::whereIn('id', $data)->get(); case 'albums': return Album::whereIn('id', $data)->get(); case 'agoda': return AgodaHotel::whereIn('hotel_id', $data)->get(); default: return false; } }