-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #117 from sarapis/development
code optimization and add new feature
- Loading branch information
Showing
386 changed files
with
232,236 additions
and
42,647 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace App\Exports\zip; | ||
|
||
use App\Model\Accessibility; | ||
use Illuminate\Contracts\View\View; | ||
use Maatwebsite\Excel\Concerns\FromView; | ||
use Maatwebsite\Excel\Concerns\WithCustomCsvSettings; | ||
|
||
class AccessibilityZipExport implements FromView, WithCustomCsvSettings | ||
{ | ||
public $enclosure; | ||
public function __construct($enclosure) | ||
{ | ||
$this->enclosure = $enclosure; | ||
} | ||
/** | ||
* @return View | ||
*/ | ||
public function view(): View | ||
{ | ||
$accessibility_for_disabilities = Accessibility::cursor(); | ||
return view('exports.zip.accessibility_for_disabilities', [ | ||
'accessibility_for_disabilities' => $accessibility_for_disabilities, | ||
]); | ||
} | ||
public function getCsvSettings(): array | ||
{ | ||
if ($this->enclosure) { | ||
return [ | ||
'delimiter' => ',', | ||
'enclosure' => '', | ||
]; | ||
} | ||
return []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
namespace App\Exports\zip; | ||
|
||
use App\Model\Address; | ||
use App\Model\LocationAddress; | ||
use Illuminate\Contracts\View\View; | ||
use Maatwebsite\Excel\Concerns\FromView; | ||
use Maatwebsite\Excel\Concerns\WithCustomCsvSettings; | ||
|
||
class AddressZipExport implements FromView, WithCustomCsvSettings | ||
{ | ||
public $location_recordids_temp, $enclosure; | ||
public function __construct($location_recordids_temp, $enclosure) | ||
{ | ||
$this->location_recordids_temp = $location_recordids_temp; | ||
$this->enclosure = $enclosure; | ||
} | ||
|
||
|
||
/** | ||
* @return View | ||
*/ | ||
public function view(): View | ||
{ | ||
if (isset($this->location_recordids_temp) && count($this->location_recordids_temp) > 0) { | ||
$chunk = $this->location_recordids_temp; | ||
$chunk = array_chunk($chunk, 500); | ||
|
||
$table_address = collect(); | ||
for ($i = 0; $i < count($chunk); $i++) { | ||
$address_record_ids = LocationAddress::whereIn('location_recordid', $chunk[$i])->pluck('address_recordid')->toArray(); | ||
$query = Address::whereIn('address_recordid', $address_record_ids)->get(); | ||
$addresses = $table_address->merge($query); | ||
} | ||
} else { | ||
$addresses = Address::get(); | ||
} | ||
return view('exports.zip.addresses', [ | ||
'addresses' => $addresses, | ||
]); | ||
} | ||
public function getCsvSettings(): array | ||
{ | ||
if ($this->enclosure) { | ||
return [ | ||
'delimiter' => ',', | ||
'enclosure' => '', | ||
]; | ||
} | ||
return []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
namespace App\Exports\zip; | ||
|
||
use App\Model\Contact; | ||
use Illuminate\Contracts\View\View; | ||
use Maatwebsite\Excel\Concerns\FromView; | ||
use Maatwebsite\Excel\Concerns\WithCustomCsvSettings; | ||
|
||
class ContactZipExport implements FromView, WithCustomCsvSettings | ||
{ | ||
public $organization_ids, $enclosure; | ||
|
||
public function __construct($organization_ids, $enclosure) | ||
{ | ||
$this->organization_ids = $organization_ids; | ||
$this->enclosure = $enclosure; | ||
} | ||
/** | ||
* @return View | ||
*/ | ||
public function view(): View | ||
{ | ||
$contacts = Contact::select('*'); | ||
if ($this->organization_ids) { | ||
$contacts->where('contact_organizations', $this->organization_ids); | ||
} | ||
|
||
return view('exports.zip.contacts', [ | ||
'contacts' => $contacts->cursor(), | ||
]); | ||
} | ||
public function getCsvSettings(): array | ||
{ | ||
if ($this->enclosure) { | ||
return [ | ||
'delimiter' => ',', | ||
'enclosure' => '', | ||
]; | ||
} | ||
return []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace App\Exports\zip; | ||
|
||
use App\Model\Language; | ||
use Illuminate\Contracts\View\View; | ||
use Maatwebsite\Excel\Concerns\FromView; | ||
use Maatwebsite\Excel\Concerns\WithCustomCsvSettings; | ||
|
||
class LanguageZipExport implements FromView, WithCustomCsvSettings | ||
{ | ||
public $enclosure; | ||
public function __construct($enclosure) | ||
{ | ||
$this->enclosure = $enclosure; | ||
} | ||
/** | ||
* @return View | ||
*/ | ||
public function view(): View | ||
{ | ||
$languages = Language::cursor(); | ||
return view('exports.zip.languages', [ | ||
'languages' => $languages, | ||
]); | ||
} | ||
public function getCsvSettings(): array | ||
{ | ||
if ($this->enclosure) { | ||
return [ | ||
'delimiter' => ',', | ||
'enclosure' => '', | ||
]; | ||
} | ||
return []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace App\Exports\zip; | ||
|
||
use App\Model\LocationAddress; | ||
use Maatwebsite\Excel\Concerns\FromCollection; | ||
use Maatwebsite\Excel\Concerns\WithCustomCsvSettings; | ||
use Maatwebsite\Excel\Concerns\WithHeadings; | ||
|
||
class LocationAddressZipExport implements FromCollection, WithCustomCsvSettings, WithHeadings | ||
{ | ||
public $enclosure; | ||
public function __construct($enclosure) | ||
{ | ||
$this->enclosure = $enclosure; | ||
} | ||
public function headings(): array | ||
{ | ||
return [ | ||
'id', | ||
'location_recordid', | ||
'address_recordid', | ||
'created_at', | ||
'updated_at', | ||
]; | ||
} | ||
|
||
/** | ||
* @return \Illuminate\Support\Collection | ||
*/ | ||
public function collection() | ||
{ | ||
return LocationAddress::all(); | ||
} | ||
public function getCsvSettings(): array | ||
{ | ||
if ($this->enclosure) { | ||
return [ | ||
'delimiter' => ',', | ||
'enclosure' => '', | ||
]; | ||
} | ||
return []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace App\Exports\zip; | ||
|
||
use App\Model\LocationPhone; | ||
use Maatwebsite\Excel\Concerns\FromCollection; | ||
use Maatwebsite\Excel\Concerns\WithCustomCsvSettings; | ||
use Maatwebsite\Excel\Concerns\WithHeadings; | ||
|
||
class LocationPhoneZipExport implements FromCollection, WithCustomCsvSettings, WithHeadings | ||
{ | ||
public $enclosure; | ||
public function __construct($enclosure) | ||
{ | ||
$this->enclosure = $enclosure; | ||
} | ||
public function headings(): array | ||
{ | ||
return [ | ||
'id', | ||
'location_recordid', | ||
'phone_recordid', | ||
'created_at', | ||
'updated_at', | ||
]; | ||
} | ||
|
||
/** | ||
* @return \Illuminate\Support\Collection | ||
*/ | ||
public function collection() | ||
{ | ||
return LocationPhone::all(); | ||
} | ||
public function getCsvSettings(): array | ||
{ | ||
if ($this->enclosure) { | ||
return [ | ||
'delimiter' => ',', | ||
'enclosure' => '', | ||
]; | ||
} | ||
return []; | ||
} | ||
} |
Oops, something went wrong.