Beispiel #1
0
 public function getById(Request $request, Application $app, $user_id)
 {
     $model = new User($app['neo']);
     $user = $model->getById($user_id);
     if ($user) {
         return $this->sendJson($user, 200);
     } else {
         return $this->sendJson(['success' => false], 404);
     }
 }
Beispiel #2
0
 public function generateUsers(Request $request, Application $app)
 {
     $countries = (require_once DATA_DIR . 'countries.php');
     $names = array_map(function ($el) {
         $parts = explode(' ', $el);
         return "{$parts[0]} {$parts[1]}";
     }, file(DATA_DIR . 'names.txt', FILE_IGNORE_NEW_LINES));
     $model = new User($app['neo']);
     $results = $model->generate($names, $countries);
     return $this->sendJson(['success' => true], 200);
 }