diff --git a/app/Console/Commands/excel/UKDigitallCharity.php b/app/Console/Commands/excel/UKDigitallCharity.php index d9cf0d66e..18e12cbd2 100644 --- a/app/Console/Commands/excel/UKDigitallCharity.php +++ b/app/Console/Commands/excel/UKDigitallCharity.php @@ -44,7 +44,7 @@ public function handle() { Excel::import( new UKDigitAllCharityEventsImport(), - 'uk-digitall-charity.xlsx', + 'digitall-2023.xlsx', 'excel' ); } diff --git a/app/Imports/UKDigitAllCharityEventsImport.php b/app/Imports/UKDigitAllCharityEventsImport.php index 495a8512c..06f7760ae 100644 --- a/app/Imports/UKDigitAllCharityEventsImport.php +++ b/app/Imports/UKDigitAllCharityEventsImport.php @@ -33,7 +33,7 @@ public function parseDate($date){ */ public function model(array $row) { // dd($this->parseDate($row['start_date'])); -// dd($row); + $event = new Event([ 'status' => 'APPROVED', 'title' => $row['activity_title'], @@ -52,7 +52,7 @@ public function model(array $row) { 'pub_date' => now(), 'created' => now(), 'updated' => now(), - 'codeweek_for_all_participation_code' => 'cw22-DigitAll', + 'codeweek_for_all_participation_code' => 'cw23-DigitAll', 'start_date' => $this->parseDate($row['start_date']), 'end_date' => $this->parseDate($row['end_date']), 'geoposition' => $row['latitude'] . ',' . $row['longitude'], diff --git a/app/Imports/UKDigitAllEventsImport.php b/app/Imports/UKDigitAllEventsImport.php index 1ffb24017..d6d0c5afc 100644 --- a/app/Imports/UKDigitAllEventsImport.php +++ b/app/Imports/UKDigitAllEventsImport.php @@ -32,8 +32,6 @@ public function parseDate($date){ * @return \Illuminate\Database\Eloquent\Model|null */ public function model(array $row) { -// dd($this->parseDate($row['start_date'])); -// dd($row); $event = new Event([ 'status' => 'APPROVED', 'title' => $row['activity_title'], @@ -68,11 +66,11 @@ public function model(array $row) { ->audiences() ->attach(explode(',', $row['audience_comma_separated_ids'])); } -// if ($row['theme_comma_separated_ids']) { -// $event -// ->themes() -// ->attach(explode(',', $row['theme_comma_separated_ids'])); -// } + if ($row['theme_comma_separated_ids']) { + $event + ->themes() + ->attach(explode(',', $row['theme_comma_separated_ids'])); + } Log::info($event->slug); return $event; diff --git a/resources/excel/digitall-2023.xlsx b/resources/excel/digitall-2023.xlsx new file mode 100644 index 000000000..aace24b03 Binary files /dev/null and b/resources/excel/digitall-2023.xlsx differ