Exemplo n.º 1
0
 public function blacklist()
 {
     $user = Auth::user();
     return $this->respond($user->blockedUsers->map(function ($user) {
         return $this->collectionTransformer->transformUserToSmall($user);
     }));
 }
Exemplo n.º 2
0
 public function users($type, $id)
 {
     $usersIDs = Like::usersIDs($this->str($type), $id);
     if ($usersIDs->count() == 0) {
         return $this->respond([]);
     }
     $users = User::whereIn('id', $usersIDs->toArray())->with('cars')->get();
     if (!$users) {
         return $this->respond([]);
     }
     $response = $users->map(function ($user) {
         $rsp = $this->collectionTransformer->transformUserToSmall($user);
         $rsp['cars'] = $this->collectionTransformer->transformCars($user->cars);
         return $rsp;
     });
     return $this->respond($response);
 }