function getInfo($slug) { $person = Person::where(Person::ATTR_SLUG, $slug)->get()[0]; if (is_null($person->biography)) { abort(404); } $productions = $person->productions; $productions = Production::sortByState($productions); return view("frontend/contents/person/info")->with("person", $person)->with("productions", $productions); }
function getSearch($query) { $productions = Production::search($query); $persons = Person::search($query); foreach ($persons as $person) { $pros = $person->productions()->orderBy(Production::ATTR_STATE, "DESC")->get(); foreach ($pros as $pr) { $productions[] = $pr; } } $productions = Production::sortByState($productions); return view("frontend/contents/gen/search")->with("productions", $productions)->with("persons", $persons)->with("query", $query); }