Skip to content

Commit

Permalink
Merge pull request #2146 from codeeu/2144-import-apple-events
Browse files Browse the repository at this point in the history
Apple events 2023
  • Loading branch information
alainvd committed Sep 29, 2023
2 parents e09a40b + 20a1e1f commit 9edc709
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/Console/Commands/excel/AppleEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function handle() {

Excel::import(
new AppleEventsImport(),
'apple_2022-2.xlsx',
'apple-2023.xlsx',
'excel'
);
}
Expand Down
6 changes: 4 additions & 2 deletions app/Imports/AppleEventsImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public function parseDate($date)
public function model(array $row)
{



$event = new Event([
'status' => "APPROVED",
'title' => $row["activity_title"],
Expand All @@ -46,13 +48,13 @@ public function model(array $row)
"pub_date" => now(),
"created" => now(),
"updated" => now(),
"codeweek_for_all_participation_code" => "cw22-apple-eu",
"codeweek_for_all_participation_code" => "cw23-apple-eu",
"start_date" => $this->parseDate($row['start_date']),
"end_date" => $this->parseDate($row['end_date']),
"geoposition" => $row["latitude"] . "," . $row["longitude"],
"longitude" => $row["longitude"],
"latitude" => $row["latitude"],
'language' => strtolower($row['language'])
'language' => strtolower(explode("_", $row['language'])[0])
]);

$event->save();
Expand Down
1 change: 1 addition & 0 deletions database/seeders/DatabaseSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class DatabaseSeeder extends Seeder
public function run()
{

$this->call(CountriesTableSeeder::class);
$this->call(CitiesTableSeeder::class);
$this->call(RolesAndPermissionsSeeder::class);
$this->call(LeadingTeacherRoleSeeder::class);
Expand Down
Binary file added resources/excel/apple-2023.xlsx
Binary file not shown.

0 comments on commit 9edc709

Please sign in to comment.