/**
  * Resolve the query.
  *
  * @param  mixed       $_
  * @param  array       $args
  * @param  ResolveInfo $info
  * @return array
  */
 public function resolve($_, array $args, ResolveInfo $info)
 {
     $humans = StarWarsData::humans();
     foreach ($humans as $human) {
         if ($human['name'] == $args['name']) {
             return $human;
         }
     }
     return null;
 }
Esempio n. 2
0
 /**
  * Fetch type data by id.
  *
  * @param  string $id
  * @return mixed
  */
 public function resolveById($id)
 {
     return StarWarsData::getCharacter($id);
 }