function getProductions($slug) { $category = Term::where(Term::ATTR_SLUG, $slug)->get()[0]; //Obtiene la cantidad total de producciones asociadas a la categoria $cant = Term::findOrNew($category->id)->productions()->count(); return view("frontend/contents/production/category")->with("category", $category)->with("cant", $cant); }
/** Busca un termino por su nombre, de lo contrario retorna Null * * @param type $name * @return type */ static function searchByName($name) { $terms = Term::where(Term::ATTR_NAME, ucfirst(strtolower($name)))->get(); if (!count($terms) > 0) { return null; } foreach ($terms as $term) { return $term; } }
/** Obtiene todos los terminos de una taxonomida dada por el id de la taxonomia * * @param type $taxonomy_id * @return type */ public static function getAllTerms($taxonomy_id) { return is_numeric($taxonomy_id) ? Term::where(Term::ATTR_TAXONOMY_ID, $taxonomy_id)->get() : null; }