BLUE
PHP 7.4.33
Path:
/var/www/multi-event-cfp.bitkit.dk/httpdocs/app/Imports
Run
Logout
Edit File
Size: 6.59 KB
Close
/var/www/multi-event-cfp.bitkit.dk/httpdocs/app/Imports/ImportUserTemplate.php
Text
Base64
<?php namespace App\Imports; use Maatwebsite\Excel\Concerns\Exportable; use Maatwebsite\Excel\Concerns\WithMultipleSheets; use App\Imports\Sheets\UserData; use App\Imports\Sheets\GuidelineData; use App\Imports\Sheets\CountryData; use App\Imports\Sheets\NationalityData; use App\Imports\Sheets\CompanyData; use App\Imports\Sheets\IndustryAreaData; use App\Imports\Sheets\CategoryAndSubCategoryData; use App\Imports\Sheets\RolesData; use App\Models\User; use Illuminate\Support\Facades\Config; use Maatwebsite\Excel\Concerns\ShouldAutoSize; class ImportUserTemplate implements WithMultipleSheets, ShouldAutoSize { use Exportable; protected $year; public function __construct($heading, $category_field, $sub_category_field, $short_form_terms_option) { $this->heading = $heading; $this->category_field = $category_field; $this->sub_category_field = $sub_category_field; $this->short_form_terms_option = $short_form_terms_option; } public function guidelineData() { $heading = [ 'Field', 'Description', ]; $data = Config::get('constants.guideline'); //merging category subcategory guidelines $categoryLabel = $this->category_field[0]['label']; $categoryGuideLine = [ 'field' => $categoryLabel, 'description' => "You can add multiple $categoryLabel using semi-colon separated methodology. eg: category1;category2 ie: All $categoryLabel are listed in the categories and subcategories worksheet." ]; //checking subcategory exist if ($this->sub_category_field[0]['enabled']) { $subCategoryLabel = $this->sub_category_field[0]['label']; $updatedGuideLine = array_merge($data, array( $categoryGuideLine, [ 'field' => $subCategoryLabel, 'description' => "You can add multiple $subCategoryLabel using semi-colon separated methodology. eg: category1;category2 ie: All $subCategoryLabel are listed in the categories and subcategories worksheet." ] )); } else { $updatedGuideLine = array_merge($data, array( $categoryGuideLine )); } $finalData = array_merge([$heading], [$updatedGuideLine]); return $finalData; } public function countryData() { $heading = [ 'Country Name', 'Code', ]; $data = Config::get('constants.countries'); $finalData = array_merge([$heading], [$data]); return $finalData; } public function nationalityData() { $heading = [ 'Country Name', 'Code', ]; $data = Config::get('constants.countries'); $finalData = array_merge([$heading], [$data]); return $finalData; } public function industryAreaData() { $heading = [ 'Industry Area', ]; $data = Config::get('constants.industryCode'); $finalData = array_merge([$heading], [$data]); return $finalData; } public function companyData() { $heading = [ 'Company Name', ]; $data = User::all()->where('company', '!=', null)->pluck('company')->unique()->toArray(); foreach ($data as $item) { $companies[] = [$item]; } $finalData = array_merge([$heading], [$companies]); return $finalData; } public function categoryAndSubCategoryData($category_field, $sub_category_field) { $categoryLabel = $category_field[0]['label']; //checking subcategory exist if ($sub_category_field[0]['enabled']) { $subCategoryLabel = $sub_category_field[0]['label']; $heading = [ "$categoryLabel", "$subCategoryLabel", ]; $options = $sub_category_field[0]['options']; foreach ($options as $data) { $category = [$data['category']['value']]; foreach ($data['subcategory'] as $item) { if ($item['enabled']) { $result_data[] = array_merge($category, [$item['group']]); } else { $result_data[] = array_merge($category, ['disabled']); } } } } else { $heading = [ "$categoryLabel", ]; $options = $category_field[0]['options']; foreach ($options as $data) { $result_data[] = [$data['label']]; } } $finalData = array_merge([$heading], [$result_data]); return $finalData; } public function rolesData() { $heading = [ 'Roles', ]; $data = Config::get('constants.eventRoles'); $finalData = array_merge([$heading], [$data]); return $finalData; } /** * @return array */ public function sheets(): array { $guideLineData = $this->guidelineData(); $countryData = $this->countryData(); $nationalityData = $this->nationalityData(); $industryAreaData = $this->industryAreaData(); $companyData = $this->companyData(); $rolesData = $this->rolesData(); $categoryAndSubCategoryData = $this->categoryAndSubCategoryData($this->category_field, $this->sub_category_field); $subCategoryEnable = $this->sub_category_field[0]['enabled']; $sheets = [ 'UserData' => new UserData($this->heading, $subCategoryEnable, count($companyData[1]), $this->short_form_terms_option), 'Guideline' => new GuidelineData($guideLineData), 'Country' => new CountryData($countryData), 'Nationality' => new NationalityData($nationalityData), 'IndustryArea' => new IndustryAreaData($industryAreaData), 'Company' => new CompanyData($companyData), 'CategoryAndSubCategory' => new CategoryAndSubCategoryData($categoryAndSubCategoryData), 'Roles' => new RolesData($rolesData), ]; return $sheets; } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 1 × Files: 4
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
Sheets
DIR
-
drwxr-xr-x
2025-04-07 06:15:39
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ImportUserTemplate.php
6.59 KB
lrw-rw-r--
2026-02-03 05:38:24
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
UsersImport.php
23.98 KB
lrw-rw-r--
2026-02-03 05:38:20
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
WucImport.php
12.76 KB
lrw-r--r--
2024-02-09 12:37:30
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
WucUserFilesImport.php
4.78 KB
lrw-r--r--
2024-02-09 12:37:30
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).