Пример #1
0
 /**
  * Display the specified mosque:
  * Name in English
  * Name in second language
  * Geo (long/lat)
  * Prayer Start Time in UTC, HH:MM 24 hours format
  * Prayer End Time in UTC, HH:MM 24 hours format, or null
  * Mosque Interior Space note, real number between 0 and 5
  * Mosque Parking Space note, real number between 0 and 5
  * Address
  * City
  * State
  *
  * @param  int  $mosqueId
  * @return Response with status_code 200 if OK, 400 otherwise
  */
 public function show($mosqueId)
 {
     $mosque = Mosque::where('id', $mosqueId)->first();
     if ($mosque != null) {
         return Response::json(array('data' => $mosque, 'status_code' => 200, 'params' => $mosqueId), 200);
     } else {
         throw new BadRequestException('This mosque does not exist.');
     }
 }
Пример #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $ennasr = Place::where([['type', '=', "city"], ['name', '=', 'Ennasr']])->first();
     $sahloul = Place::where([['type', '=', "city"], ['name', '=', 'Sahloul']])->first();
     $jawhara = Place::where([['type', '=', "city"], ['name', '=', 'Cité Jawhara']])->first();
     $sousse = Place::where([['type', '=', "state"], ['name', '=', 'Sousse']])->first();
     if ($ennasr == null || $sahloul == null || $jawhara == null || $sousse == null) {
         echo "Some places are missing.";
         return;
     }
     $mosque1 = Mosque::create(['name' => 'Mosquée Farhat Hached Jawhara', 'second_name' => null, 'latitude' => '35.832436', 'longitude' => '10.622167', 'prayer_start' => '13:00', 'prayer_start_confirmations' => 2, 'prayer_end' => '13:30', 'prayer_end_confirmations' => 1, 'interior_space' => 4, 'interior_space_confirmations' => 1, 'parking_space' => 4.5, 'parking_space_confirmations' => 4, 'address' => 'Avenue du 20 Mars 1956, Sousse', 'city' => $jawhara->id, 'state' => $sousse->id]);
     $mosque2 = Mosque::create(['name' => 'Great Grand Mosque', 'second_name' => 'Great Grand Mosque', 'latitude' => '35.827061', 'longitude' => '10.639773', 'prayer_start' => '12:30', 'prayer_start_confirmations' => 4, 'prayer_end' => '12:50', 'prayer_end_confirmations' => 1, 'interior_space' => 3.5, 'interior_space_confirmations' => 1, 'parking_space' => 1.6, 'parking_space_confirmations' => 4, 'address' => 'Rue Othmane Osmane, Sousse', 'state' => $sousse->id]);
     $mosque3 = Mosque::create(['name' => 'Al-Fath Mosque', 'second_name' => 'Mosqué Al Fath', 'latitude' => '35.842952', 'longitude' => '10.617726', 'prayer_start' => '13:00', 'prayer_start_confirmations' => 12, 'prayer_end' => '13:45', 'prayer_end_confirmations' => 5, 'interior_space' => 4.8, 'interior_space_confirmations' => 10, 'parking_space' => 4.3, 'parking_space_confirmations' => 4, 'address' => '', 'city' => $jawhara->id, 'state' => $sousse->id]);
     $mosque4 = Mosque::create(['name' => 'Mosquee assabr', 'second_name' => 'Mosquee assabr', 'latitude' => '35.842986', 'longitude' => '10.597665', 'prayer_start' => '12:50', 'prayer_start_confirmations' => 4, 'prayer_end' => '13:15', 'prayer_end_confirmations' => 4, 'interior_space' => 2.2, 'interior_space_confirmations' => 5, 'parking_space' => 1, 'parking_space_confirmations' => 1, 'address' => 'Hammam Sousse', 'city' => $sahloul->id, 'state' => $sousse->id]);
     $mosque5 = Mosque::create(['name' => 'Fatima Ez-Zahra Mosque', 'second_name' => 'Fatima Ez-Zahra Mosque', 'latitude' => '35.842307', 'longitude' => '10.588133', 'prayer_start' => '13:20', 'prayer_start_confirmations' => 17, 'prayer_end' => '14:00', 'prayer_end_confirmations' => 8, 'interior_space' => 2.6, 'interior_space_confirmations' => 3, 'parking_space' => null, 'parking_space_confirmations' => 0, 'address' => 'Sahloul, Sousse', 'city' => $sahloul->id, 'state' => $sousse->id]);
     $mosque6 = Mosque::create(['name' => 'Mosquée El Salam', 'second_name' => '', 'latitude' => '36.859904', 'longitude' => '10.163426', 'prayer_start' => '13:10', 'prayer_start_confirmations' => 21, 'prayer_end' => '13:35', 'prayer_end_confirmations' => 10, 'interior_space' => 3.1, 'interior_space_confirmations' => 17, 'parking_space' => 4.9, 'parking_space_confirmations' => 28, 'address' => 'Ennasr, Ariana', 'city' => $ennasr->id, 'state' => $ennasr['parent']]);
 }