/** * Returns a post type by slug * @param type $slug * @return type */ public function getBySlug($slug) { if (!$slug) { return null; } return PostType::where('slug', '=', $slug)->first(); }