| @@ 37-46 (lines=10) @@ | ||
| 34 | * |
|
| 35 | * @return Slim\Http\Response |
|
| 36 | */ |
|
| 37 | public function getAllEmojis($request, $response, $args) |
|
| 38 | { |
|
| 39 | $emoji = Emoji::with('keywords', 'created_by')->get(); |
|
| 40 | ||
| 41 | if (count($emoji) > 0) { |
|
| 42 | return $response->withJson($emoji); |
|
| 43 | } |
|
| 44 | ||
| 45 | return $response->withJson(['message' => 'Oops, No Emoji to display'], 404); |
|
| 46 | } |
|
| 47 | ||
| 48 | /** |
|
| 49 | * Get a single emoji. |
|
| @@ 57-65 (lines=9) @@ | ||
| 54 | * |
|
| 55 | * @return Slim\Http\Response |
|
| 56 | */ |
|
| 57 | public function getSingleEmoji($request, $response, $args) |
|
| 58 | { |
|
| 59 | $emoji = Emoji::with('keywords', 'created_by')->find($args['id']); |
|
| 60 | ||
| 61 | if (count($emoji) < 1) { |
|
| 62 | return $response->withJson(['message' => 'The requested Emoji is not found.'], 404); |
|
| 63 | } |
|
| 64 | ||
| 65 | return $response->withJson($emoji); |
|
| 66 | } |
|
| 67 | ||
| 68 | /** |
|