Commit fd35cda6 authored by Andrea Ruggiero's avatar Andrea Ruggiero
Browse files

add images

parent c890bb69
Pipeline #1581 failed with stage
in 1 minute and 38 seconds
......@@ -41,7 +41,8 @@ class EventController extends Controller
"capacity" => $place->capacity,
"latitude" => $place->latitude,
"longitude" => $place->longitude,
"address" => $place->address
"address" => $place->address,
"id" => $place->id
];
}, $placeRepository->all());
break;
......@@ -52,7 +53,8 @@ class EventController extends Controller
"capacity" => $place->capacity,
"latitude" => $place->latitude,
"longitude" => $place->longitude,
"address" => $place->address
"address" => $place->address,
"id" => $place->id
];
}
}
......@@ -67,7 +69,8 @@ class EventController extends Controller
"type" => $event->type,
"theme" => $event->theme,
"bookings" => count($bookingRepository->getBookingsByEvent($event->event_id)),
"places" => $places
"places" => $places,
"image" => count($places) > 0 ? $this->getImage($places[0]) : null
];
if ($user !== null) {
......@@ -103,7 +106,8 @@ class EventController extends Controller
"capacity" => $place->capacity,
"latitude" => $place->latitude,
"longitude" => $place->longitude,
"address" => $place->address
"address" => $place->address,
"id" => $place->id
];
}, $placeRepository->all());
break;
......@@ -114,7 +118,8 @@ class EventController extends Controller
"capacity" => $place->capacity,
"latitude" => $place->latitude,
"longitude" => $place->longitude,
"address" => $place->address
"address" => $place->address,
"id" => $place->id
];
}
}
......@@ -129,7 +134,8 @@ class EventController extends Controller
"type" => $event->type,
"theme" => $event->theme,
"bookings" => count($bookingRepository->getBookingsByEvent($event->event_id)),
"places" => $places
"places" => $places,
"image" => count($places) > 0 ? $this->getImage($places[0]) : null
];
$response[] = $temp;
......@@ -185,7 +191,8 @@ class EventController extends Controller
"capacity" => $place->capacity,
"latitude" => $place->latitude,
"longitude" => $place->longitude,
"address" => $place->address
"address" => $place->address,
"id" => $place->id
];
}, $placeRepository->all());
break;
......@@ -196,7 +203,8 @@ class EventController extends Controller
"capacity" => $place->capacity,
"latitude" => $place->latitude,
"longitude" => $place->longitude,
"address" => $place->address
"address" => $place->address,
"id" => $place->id
];
}
}
......@@ -211,7 +219,8 @@ class EventController extends Controller
"type" => $event->type,
"theme" => $event->theme,
"bookings" => count($bookingRepository->getBookingsByEvent($event->event_id)),
"places" => $places
"places" => $places,
"image" => count($places) > 0 ? $this->getImage($places[0]) : null
];
if ($user !== null) {
......@@ -221,4 +230,17 @@ class EventController extends Controller
return ApiResponse::success([ 'event' => $response]);
}
private function getImage($place) {
$total = [
0 => 6,
1 => 0,
2 => 2,
3 => 4,
4 => 0,
5 => 4,
6 => 2
];
$md5 = md5($place["name"]);
return 'http://185.53.148.21/'.$place["id"].'/'.abs($md5[0] % $total[$place["id"]]).'.jpg';
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment