├── .github └── FUNDING.yml ├── .gitignore ├── LICENSE.md ├── README.md ├── composer.json └── src ├── Commands └── GedcomImporter.php ├── Events └── GedComProgressSent.php ├── Facades └── GedcomParserFacade.php ├── Models ├── Addr.php ├── Author.php ├── Chan.php ├── Citation.php ├── Event.php ├── Family.php ├── FamilyEvent.php ├── FamilySlgs.php ├── ImportJob.php ├── MediaObject.php ├── MediaObjeectFile.php ├── Note.php ├── Person.php ├── PersonAlia.php ├── PersonAnci.php ├── PersonAsso.php ├── PersonEvent.php ├── PersonLds.php ├── PersonName.php ├── PersonNameFone.php ├── PersonNameRomn.php ├── PersonSubm.php ├── Place.php ├── Publication.php ├── Refn.php ├── Repository.php ├── Source.php ├── SourceData.php ├── SourceDataEven.php ├── SourceRef.php ├── SourceRefEven.php ├── SourceRepo.php ├── Subm.php └── Subn.php ├── Observers └── EventActionsObserver.php ├── ServiceProvider.php ├── Utils ├── DateParser.php ├── GedcomGenerator.php ├── GedcomParser.php ├── GedcomWriter.php └── Importer │ ├── Addr.php │ ├── Caln.php │ ├── Chan.php │ ├── Date.php │ ├── Fam │ ├── Even.php │ └── Slgs.php │ ├── Indi │ ├── Alia.php │ ├── Anci.php │ ├── Asso.php │ ├── Desi.php │ ├── Even.php │ ├── Even │ │ └── Plac.php │ ├── Lds.php │ ├── Name.php │ ├── Name │ │ ├── Fone.php │ │ └── Romn.php │ └── Subm.php │ ├── Note.php │ ├── NoteRef.php │ ├── Obje.php │ ├── ObjeRef.php │ ├── ObjeRef │ └── File.php │ ├── Phon.php │ ├── Refn.php │ ├── Repo.php │ ├── RepoRef.php │ ├── Sour.php │ ├── Sour │ ├── Data.php │ ├── Data │ │ └── Even.php │ └── Repo.php │ ├── SourRef.php │ ├── SourRef │ └── Even.php │ ├── Subm.php │ └── Subn.php └── migrations ├── 2020_01_01_120000_create_default_people_table.php ├── 2020_04_10_154637_create_citations_table.php ├── 2020_04_10_154850_create_families_table.php ├── 2020_04_10_155019_create_notes_table.php ├── 2020_04_10_155134_create_places_table.php ├── 2020_04_10_155307_create_repositories_table.php ├── 2020_04_10_155413_create_sources_table.php ├── 2020_04_10_171030_create_types_table.php ├── 2020_04_24_211718_create_authors_table.php ├── 2020_04_24_211852_create_publications_table.php ├── 2020_06_01_112223_create_persons_events_table.php ├── 2020_06_01_112242_create_family_events_table.php ├── 2020_06_01_112312_update_events_add_timestamp.php ├── 2020_06_03_192100_add_columns_for_people_table.php ├── 2020_06_11_150000_update_add_columns_person_events_table.php ├── 2020_06_11_152802_update_description_default_places_table.php ├── 2020_06_11_173643_update_add_columns_people_table.php ├── 2020_06_11_175726_update_add_columns_family_table.php ├── 2020_06_12_173700_create_subns_table.php ├── 2020_06_12_190711_create_subm_table.php ├── 2020_06_13_003901_create_media_objects_table.php ├── 2020_06_23_031852_create_importjobs_table.php ├── 2020_06_24_084354_create_sourcedata_table.php ├── 2020_06_24_085159_create_source_data_even_table.php ├── 2020_06_24_090326_create_sourceref_even_table.php ├── 2020_06_24_092055_create_person_alia_table.php ├── 2020_06_24_093608_create_person_asso_table.php ├── 2020_06_24_094758_create_person_subm_table.php ├── 2020_06_24_095241_create_person_anci_table.php ├── 2020_06_24_103355_create_refn_table.php ├── 2020_06_24_105140_create_person_lds_table.php ├── 2020_06_24_135407_create_chans_table.php ├── 2020_06_25_040418_create_family_slgs_table.php ├── 2020_06_25_052028_create_addrs_table.php ├── 2020_08_21_100421_create_personname_table.php ├── 2020_08_21_110811_create_person_name_fone_table.php ├── 2020_08_21_111106_create_person_name_romn_table.php ├── 2020_08_21_124830_create_source_ref_table.php ├── 2020_08_30_035717_create_media_objects_file_table.php ├── 2020_08_31_092310_create_source_repo_table.php ├── 2020_09_12_000100_update_person_events_table.php └── 2020_09_12_151600_add_column_for_media_objects_table.php /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: genealogiawebsite 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright 2020 Alexander Mills (alex@asdfx.us) 2 | Copyright 2020 Genealogia Ltd 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 | 6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | 8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GEDCOM to Laravel Model 2 | ![Latest Stable Version](https://img.shields.io/github/release/genealogiawebsite/laravel-gedcom.svg) 3 | [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/genealogiawebsite/laravel-gedcom/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/genealogiawebsite/laravel-gedcom/?branch=master) 4 | [![Build Status](https://scrutinizer-ci.com/g/genealogiawebsite/laravel-gedcom/badges/build.png?b=master)](https://scrutinizer-ci.com/g/genealogiawebsite/laravel-gedcom/build-status/master) 5 | [![Code Intelligence Status](https://scrutinizer-ci.com/g/genealogiawebsite/laravel-gedcom/badges/code-intelligence.svg?b=master)](https://scrutinizer-ci.com/code-intelligence) 6 | [![StyleCI](https://github.styleci.io/repos/268533904/shield?branch=master)](https://github.styleci.io/repos/268533904) 7 | [![CodeFactor](https://www.codefactor.io/repository/github/genealogiawebsite/laravel-gedcom/badge/master)](https://www.codefactor.io/repository/github/genealogiawebsite/laravel-gedcom/overview/master) 8 | [![codebeat badge](https://codebeat.co/badges/911f9e33-212a-4dfa-a860-751cdbbacff7)](https://codebeat.co/projects/github-com-modulargenealogy-gedcom-laravel-gedcom-master) 9 | [![Build Status](https://travis-ci.org/genealogiawebsite/laravel-gedcom.svg?branch=master)](https://travis-ci.org/genealogiawebsite/laravel-gedcom) 10 | 11 | 12 | genealogiawebsite/laravel-gedcom is a package to parse [GEDCOM](https://en.wikipedia.org/wiki/GEDCOM) files, and import them 13 | as Laravel models, inside your Laravel application. It is used by: 14 | (https://github.com/genealogiawebsite/genealogy) 15 | 16 | ## Installation 17 | ``` 18 | composer require genealogiawebsite/laravel-gedcom 19 | ``` 20 | 21 | ## Usage 22 | 23 | You must create the database schema before doing anything, so run the migrations: 24 | ``` 25 | php artisan migrate 26 | ``` 27 | 28 | ### via Command Line 29 | ``` 30 | php artisan gedcom:import /path/to/your/gedcom/file.ged 31 | ``` 32 | 33 | ### via Facade 34 | ``` 35 | use GenealogiaWebsite\LaravelGedcom\Facades\GedcomParserFacade; 36 | $filename = '/path/to/your/gedcom/file.ged'; 37 | GedcomParserFacade::parse($filename, true); 38 | ``` 39 | 40 | ### via Instantiation 41 | ``` 42 | use \GenealogiaWebsite\LaravelGedcom\Utils\GedcomParser; 43 | $filename = '/path/to/your/gedcom/file.ged'; 44 | $parser = new GedcomParser(); 45 | $parser->parse($filename, true); 46 | ``` 47 | 48 | ## Documentation 49 | 50 | ### Database 51 | This package will create the database tables, which map to models. 52 | 53 | ### `parse()` Method 54 | The `parse()` method takes three parameters, `string $filename`, `bool $progressBar = false` 55 | and `string $conn` 56 | If you set `$progressBar` to true, a ProgressBar will be output to `php://stdout`, which is useful when you are calling 57 | the parser from Artisan commands. 58 | 59 | ## Contributing 60 | 61 | Pull requests are welcome, as are issues. 62 | 63 | ## Contributors 64 | 65 | 66 | 67 | ## License 68 | 69 | MIT License (see License.md). This means you must retain the copyright and permission notice is all copies, or 70 | substantial portions of this software. 71 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "genealogiawebsite/laravel-gedcom", 3 | "description": "A package that converts gedcom files to Eloquent models", 4 | "type": "library", 5 | "require": { 6 | "genealogiawebsite/php-gedcom": "^1.0" 7 | }, 8 | "license": "MIT", 9 | "autoload": { 10 | "psr-4": { 11 | "GenealogiaWebsite\\LaravelGedcom\\": "src" 12 | } 13 | }, 14 | "extra": { 15 | "laravel": { 16 | "providers": [ 17 | "GenealogiaWebsite\\LaravelGedcom\\ServiceProvider" 18 | ] 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Commands/GedcomImporter.php: -------------------------------------------------------------------------------- 1 | argument('filename'); 42 | GedcomParserFacade::parse('mysql', $filename, true, true); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Events/GedComProgressSent.php: -------------------------------------------------------------------------------- 1 | slug = $slug; 29 | $this->total = $total; 30 | $this->complete = $complete; 31 | $this->queue = 'low'; 32 | } 33 | 34 | /** 35 | * Get the channels the event should broadcast on. 36 | * 37 | * @return \Illuminate\Broadcasting\Channel|array 38 | */ 39 | public function broadcastOn() 40 | { 41 | return new Channel('gedcom-progress'); 42 | } 43 | 44 | public function broadcastAs() 45 | { 46 | return 'newMessage'; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Facades/GedcomParserFacade.php: -------------------------------------------------------------------------------- 1 | false]; 12 | 13 | protected $casts = ['is_active' => 'boolean']; 14 | } 15 | -------------------------------------------------------------------------------- /src/Models/Chan.php: -------------------------------------------------------------------------------- 1 | false]; 12 | 13 | protected $casts = ['is_active' => 'boolean']; 14 | 15 | public function sources() 16 | { 17 | return $this->belongsToMany(Source::class); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Models/Event.php: -------------------------------------------------------------------------------- 1 | hasOne(Place::class, 'id', 'places_id'); 14 | } 15 | 16 | public function getPlacename() 17 | { 18 | if ($this->place) { 19 | return $this->place->title; 20 | } else { 21 | return 'unknown place'; 22 | } 23 | } 24 | 25 | public function getTitle() 26 | { 27 | return $this->gedcom_event_names[$this->title] ?? $this->title; 28 | } 29 | 30 | public function scopeOrderByDate($query) 31 | { 32 | return $query->orderBy('year')->orderBy('month')->orderBy('day'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Models/Family.php: -------------------------------------------------------------------------------- 1 | false]; 12 | 13 | protected $casts = ['is_active' => 'boolean']; 14 | 15 | public function events() 16 | { 17 | return $this->hasMany(FamilyEvent::class); 18 | } 19 | 20 | public function children() 21 | { 22 | return $this->hasMany(Person::class, 'child_in_family_id'); 23 | } 24 | 25 | public function husband() 26 | { 27 | return $this->hasOne(Person::class, 'id', 'husband_id'); 28 | } 29 | 30 | public function wife() 31 | { 32 | return $this->hasOne(Person::class, 'id', 'wife_id'); 33 | } 34 | 35 | public function title() 36 | { 37 | return (($this->husband) ? $this->husband->fullname() : '?'). 38 | ' + '. 39 | (($this->wife) ? $this->wife->fullname() : '?'); 40 | } 41 | 42 | public static function getList() 43 | { 44 | $families = self::get(); 45 | $result = []; 46 | foreach ($families as $family) { 47 | $result[$family->id] = $family->title(); 48 | } 49 | 50 | return collect($result); 51 | } 52 | 53 | public function addEvent($title, $date, $place, $description = '') 54 | { 55 | $place_id = Place::getIdByTitle($place); 56 | $event = FamilyEvent::updateOrCreate( 57 | [ 58 | 'family_id' => $this->id, 59 | 'title' => $title, 60 | ], 61 | [ 62 | 'family_id' => $this->id, 63 | 'title' => $title, 64 | 'description' => $description, 65 | ] 66 | ); 67 | if ($date) { 68 | $event->date = $date; 69 | $event->save(); 70 | } 71 | if ($place) { 72 | $event->places_id = $place_id; 73 | $event->save(); 74 | } 75 | } 76 | 77 | public function getWifeName() 78 | { 79 | if ($this->wife) { 80 | return $this->wife->fullname(); 81 | } else { 82 | return 'unknown woman'; 83 | } 84 | } 85 | 86 | public function getHusbandName() 87 | { 88 | if ($this->husband) { 89 | return $this->husband->fullname(); 90 | } else { 91 | return 'unknown man'; 92 | } 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/Models/FamilyEvent.php: -------------------------------------------------------------------------------- 1 | hasOne(Family::class, 'id', 'family_id'); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Models/FamilySlgs.php: -------------------------------------------------------------------------------- 1 | false]; 19 | 20 | protected $casts = ['is_active' => 'boolean']; 21 | 22 | public function person() 23 | { 24 | return $this->belongsToMany(Person::class); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Models/Person.php: -------------------------------------------------------------------------------- 1 | hasMany(PersonEvent::class); 33 | } 34 | 35 | public function child_in_family() 36 | { 37 | return $this->belongsTo(Family::class, 'child_in_family_id'); 38 | } 39 | 40 | public function husband_in_family() 41 | { 42 | return $this->hasMany(Family::class, 'husband_id'); 43 | } 44 | 45 | public function wife_in_family() 46 | { 47 | return $this->hasMany(Family::class, 'wife_id'); 48 | } 49 | 50 | public function fullname() 51 | { 52 | return $this->givn.' '.$this->surn; 53 | } 54 | 55 | public function getSex() 56 | { 57 | if ($this->sex == 'F') { 58 | return 'Female'; 59 | } 60 | 61 | return 'Male'; 62 | } 63 | 64 | public static function getList() 65 | { 66 | $persons = self::get(); 67 | $result = []; 68 | foreach ($persons as $person) { 69 | $result[$person->id] = $person->fullname(); 70 | } 71 | 72 | return collect($result); 73 | } 74 | 75 | public function addEvent($title, $date, $place, $description = '') 76 | { 77 | $place_id = Place::getIdByTitle($place); 78 | $event = PersonEvent::updateOrCreate( 79 | [ 80 | 'person_id' => $this->id, 81 | 'title' => $title, 82 | ], 83 | [ 84 | 'person_id' => $this->id, 85 | 'title' => $title, 86 | 'description' => $description, 87 | ] 88 | ); 89 | 90 | if ($date) { 91 | $event->date = $date; 92 | $event->save(); 93 | } 94 | 95 | if ($place) { 96 | $event->places_id = $place_id; 97 | $event->save(); 98 | } 99 | 100 | // add birthyear to person table ( for form builder ) 101 | if ($title == 'BIRT' && !empty($date)) { 102 | $this->birthday = date('Y-m-d', strtotime($date)); 103 | } 104 | // add deathyear to person table ( for form builder ) 105 | if ($title == 'DEAT' && !empty($date)) { 106 | $this->deathday = date('Y-m-d', strtotime($date)); 107 | } 108 | $this->save(); 109 | 110 | return $event; 111 | } 112 | 113 | public function birth() 114 | { 115 | return $this->events->where('title', '=', 'BIRT')->first(); 116 | } 117 | 118 | public function death() 119 | { 120 | return $this->events->where('title', '=', 'DEAT')->first(); 121 | } 122 | 123 | public function appellative() 124 | { 125 | return $this->givn; 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /src/Models/PersonAlia.php: -------------------------------------------------------------------------------- 1 | 'Birth', 36 | 'DEAT' => 'Death', 37 | ]; 38 | 39 | public static function boot() 40 | { 41 | parent::boot(); 42 | 43 | self::observe(new EventActionsObserver()); 44 | } 45 | 46 | public function person() 47 | { 48 | return $this->hasOne(Person::class, 'id', 'person_id'); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Models/PersonLds.php: -------------------------------------------------------------------------------- 1 | first(); 18 | if ($place !== null) { 19 | $id = $place->id; 20 | } else { 21 | $place = self::create(compact('title')); 22 | $id = $place->id; 23 | } 24 | 25 | return $id; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Models/Publication.php: -------------------------------------------------------------------------------- 1 | false]; 12 | 13 | protected $casts = ['is_active' => 'boolean']; 14 | } 15 | -------------------------------------------------------------------------------- /src/Models/Refn.php: -------------------------------------------------------------------------------- 1 | false]; 19 | 20 | protected $casts = ['is_active' => 'boolean']; 21 | 22 | public function sources() 23 | { 24 | return $this->hasMany(Source::class); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Models/Source.php: -------------------------------------------------------------------------------- 1 | false]; 19 | 20 | protected $casts = ['is_active' => 'boolean']; 21 | 22 | public function repositories() 23 | { 24 | return $this->belongsTo(Repository::class); 25 | } 26 | 27 | public function citations() 28 | { 29 | return $this->hasMany(Citation::class); 30 | } 31 | 32 | public function getCitationListAttribute() 33 | { 34 | return $this->citations()->pluck('citation.id'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Models/SourceData.php: -------------------------------------------------------------------------------- 1 | date); 12 | $model->fill($parser->parse_date()); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/ServiceProvider.php: -------------------------------------------------------------------------------- 1 | commands([ 13 | GedcomImporter::class, 14 | ]); 15 | 16 | $this->app->bind('genealogiawebsite/laravel-gedcom:parser', function () { 17 | return new GedcomParser(); 18 | }); 19 | } 20 | 21 | public function boot() 22 | { 23 | $this->loadMigrationsFrom(__DIR__.'/migrations/'); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Utils/DateParser.php: -------------------------------------------------------------------------------- 1 | date_string = $date_string; 15 | } 16 | 17 | public function parse_date() 18 | { 19 | $this->trim_datestring(); 20 | if (!$this->try_parse_full_date()) { 21 | if (!$this->try_parse_M_Y_date()) { 22 | if (!$this->try_parse_Y_date()) { 23 | $this->set_null_date(); 24 | } 25 | } 26 | } 27 | 28 | return $this->export(); 29 | } 30 | 31 | private function trim_datestring() 32 | { 33 | $words_to_remove = [ 34 | // If an exact date is not known, a date range can be specified 35 | 'AFT', 'BEF', 'BET', 'AND', 36 | //For approximate dates 37 | 'ABT', 'CAL', 'EST', 38 | // Takes a property over a certain period of time ( e.g. exercise of a profession, living in a particular place ) 39 | 'FROM', 'TO', 40 | ]; 41 | foreach ($words_to_remove as $word) { 42 | $this->date_string = str_replace($word, '', $this->date_string); 43 | } 44 | $this->date_string = trim($this->date_string); 45 | } 46 | 47 | private function try_parse_full_date() 48 | { 49 | $this->set_null_date(); // Default 50 | $date_parts = explode(' ', $this->date_string); 51 | if (count($date_parts) > 3) { 52 | return false; 53 | } 54 | 55 | return $this->try_get_day( 56 | $date_parts[0] ?? false 57 | ) 58 | and 59 | $this->try_get_month( 60 | $date_parts[1] ?? false 61 | ) 62 | and 63 | $this->try_get_year( 64 | $date_parts[2] ?? false, 65 | $date_parts[3] ?? false 66 | ); 67 | } 68 | 69 | private function try_parse_M_Y_date() 70 | { 71 | $this->set_null_date(); // Default 72 | $date_parts = explode(' ', $this->date_string); 73 | if (count($date_parts) > 3) { 74 | return false; 75 | } 76 | 77 | return $this->try_get_month( 78 | $date_parts[0] ?? false 79 | ) 80 | and 81 | $this->try_get_year( 82 | $date_parts[1] ?? false, 83 | $date_parts[2] ?? false 84 | ); 85 | } 86 | 87 | private function try_parse_Y_date() 88 | { 89 | $this->set_null_date(); // Default 90 | $date_parts = explode(' ', $this->date_string); 91 | if (count($date_parts) > 2) { 92 | return false; 93 | } 94 | 95 | return $this->try_get_year( 96 | $date_parts[0] ?? false, 97 | $date_parts[1] ?? false 98 | ); 99 | } 100 | 101 | private function try_get_year($year, $epoch = false) 102 | { 103 | $sign = 1; 104 | if ($epoch) { 105 | if ($epoch == 'BC') { 106 | $sign = -1; 107 | } elseif ($epoch == 'AC') { 108 | $sign = 1; 109 | } else { 110 | return false; 111 | } 112 | } 113 | if (!$year) { 114 | return false; 115 | } 116 | if (is_numeric($year)) { 117 | $this->year = $year * $sign; 118 | } else { 119 | return false; 120 | } 121 | 122 | return true; 123 | } 124 | 125 | private function try_get_month($month) 126 | { 127 | $months = [ 128 | 'JAN' => 1, 129 | 'FEB' => 2, 130 | 'MAR' => 3, 131 | 'APR' => 4, 132 | 'MAY' => 5, 133 | 'JUN' => 6, 134 | 'JUL' => 7, 135 | 'AUG' => 8, 136 | 'SEP' => 9, 137 | 'OCT' => 10, 138 | 'NOV' => 11, 139 | 'DEC' => 12, 140 | ]; 141 | 142 | if (isset($months[$month])) { 143 | $this->month = $months[$month]; 144 | 145 | return true; 146 | } else { 147 | return false; 148 | } 149 | } 150 | 151 | private function try_get_day($day) 152 | { 153 | if (is_numeric($day)) { 154 | $this->day = $day * 1; 155 | 156 | return true; 157 | } else { 158 | return false; 159 | } 160 | } 161 | 162 | public function set_null_date() 163 | { 164 | $this->year = null; 165 | $this->month = null; 166 | $this->day = null; 167 | } 168 | 169 | public function export() 170 | { 171 | return [ 172 | 'year' => $this->year, 173 | 'month' => $this->month, 174 | 'day' => $this->day, 175 | ]; 176 | } 177 | } 178 | -------------------------------------------------------------------------------- /src/Utils/GedcomGenerator.php: -------------------------------------------------------------------------------- 1 | family_id = $family_id; 26 | $this->p_id = $p_id; 27 | $this->up_nest = $up_nest; 28 | $this->down_nest = $down_nest; 29 | $this->arr_indi_id = []; 30 | $this->arr_fam_id = []; 31 | $this->_gedcom = new Gedcom(); 32 | } 33 | 34 | public function getGedcomFamily() 35 | { 36 | $this->setHead(); 37 | $fam = $this->setFam($this->family_id); 38 | $writer = new \PhpGedcom\Writer(); 39 | $output = $writer->convert($this->_gedcom); 40 | 41 | return $output; 42 | } 43 | 44 | public function getGedcomPerson() 45 | { 46 | $this->setHead(); 47 | $this->addUpData($this->p_id); 48 | $writer = new \PhpGedcom\Writer(); 49 | $output = $writer->convert($this->_gedcom); 50 | 51 | return $output; 52 | } 53 | 54 | public function addUpData($p_id, $nest = 0) 55 | { 56 | if (empty($p_id) || $p_id < 1) { 57 | return; 58 | } 59 | if ($this->up_nest < $nest) { 60 | return; 61 | } 62 | 63 | $person = Person::find($p_id); 64 | if ($person == null) { 65 | return; 66 | } 67 | 68 | // add self to indi 69 | if (!in_array($p_id, $this->arr_indi_id)) { 70 | array_push($this->arr_indi_id, $p_id); 71 | $this->setIndi($p_id); 72 | } else { 73 | // already processed this person 74 | return; 75 | } 76 | 77 | // process family ( partner, children ) 78 | $_families = Family::where('husband_id', $p_id)->orwhere('wife_id', $p_id)->get(); 79 | foreach ($_families as $item) { 80 | // add family 81 | $f_id = $item->id; 82 | if (!in_array($f_id, $this->arr_fam_id)) { 83 | array_push($this->arr_fam_id, $f_id); 84 | $this->setFam($f_id); 85 | } 86 | 87 | // add partner to indi 88 | $husb_id = $item->husband_id; 89 | $wife_id = $item->wife_id; 90 | $this->log .= $nest.' f_id='.$f_id."\n"; 91 | $this->log .= $nest.' husb_id='.$husb_id."\n"; 92 | $this->log .= $nest.' wife_id='.$wife_id."\n"; 93 | $this->addUpData($husb_id, $nest); 94 | $this->addUpData($wife_id, $nest); 95 | 96 | // add chidrent to indi 97 | $children = Person::where('child_in_family_id', $f_id)->get(); 98 | foreach ($children as $item2) { 99 | $child_id = $item2->id; 100 | if (!in_array($child_id, $this->arr_indi_id)) { 101 | array_push($this->arr_indi_id, $child_id); 102 | $this->setIndi($child_id); 103 | } 104 | } 105 | } 106 | 107 | $parent_family_id = $person->child_in_family_id; 108 | $p_family = Family::find($parent_family_id); 109 | 110 | // there is not parent data. 111 | if ($p_family === null) { 112 | return; 113 | } 114 | 115 | // process siblings 116 | $siblings = Person::where('child_in_family_id', $parent_family_id)->get(); 117 | foreach ($siblings as $item3) { 118 | $sibling_id = $item3->id; 119 | if (!in_array($sibling_id, $this->arr_indi_id)) { 120 | array_push($this->arr_indi_id, $sibling_id); 121 | $this->setIndi($sibling_id); 122 | } 123 | } 124 | 125 | // process parent 126 | $nest++; 127 | $father_id = $p_family->husband_id; 128 | $mother_id = $p_family->wife_id; 129 | $this->addUpData($father_id, $nest); 130 | $this->addUpData($mother_id, $nest); 131 | } 132 | 133 | public function addDownData($p_id, $nest = 0) 134 | { 135 | if (empty($p_id) || $p_id < 1) { 136 | return; 137 | } 138 | if ($this->down_nest < $nest) { 139 | return; 140 | } 141 | 142 | $person = Person::find($p_id); 143 | if ($person == null) { 144 | return; 145 | } 146 | 147 | // process self 148 | if (!in_array($p_id, $this->arr_indi_id)) { 149 | // add to indi array 150 | array_push($this->arr_indi_id, $p_id); 151 | $this->setIndi($p_id); 152 | } 153 | 154 | $_families = Family::where('husband_id', $p_id)->orwhere('wife_id', $p_id)->get(); 155 | foreach ($_families as $item) { 156 | // add family 157 | $f_id = $item->id; 158 | if (!in_array($f_id, $this->arr_fam_id)) { 159 | array_push($this->arr_fam_id, $f_id); 160 | $this->setFam($f_id); 161 | } 162 | // process partner 163 | $husband_id = $item->husband_id; 164 | $wife_id = $item->wife_id; 165 | $this->addDownData($husband_id, $nest); 166 | $this->addDownData($wife_id, $nest); 167 | 168 | // process child 169 | $children = Person::where('child_in_family_id', $item->id); 170 | foreach ($children as $item2) { 171 | $child_id = $item2->id; 172 | $nest_next = $nest + 1; 173 | $this->addDownData($child_id, $nest_next); 174 | } 175 | } 176 | 177 | // process parent 178 | $parent_family_id = $person->child_in_family_id; 179 | $parent_family = Family::find($parent_family_id); 180 | if ($parent_family != null) { 181 | $father_id = $parent_family->husband_id; 182 | $mother_id = $parent_family->wife_id; 183 | if (!in_array($father_id, $this->arr_indi_id)) { 184 | array_push($this->arr_indi_id, $father_id); 185 | $this->setIndi($father_id); 186 | } 187 | if (!in_array($mother_id, $this->arr_indi_id)) { 188 | array_push($this->arr_indi_id, $mother_id); 189 | $this->setIndi($mother_id); 190 | } 191 | } 192 | // process siblings 193 | $siblings = Person::where('child_in_family_id', $parent_family_id)->get(); 194 | foreach ($siblings as $item3) { 195 | $sibling_id = $item3->id; 196 | if (!in_array($sibling_id, $this->arr_indi_id)) { 197 | $this->addDownData($sibling_id, $nest); 198 | } 199 | } 200 | } 201 | 202 | protected function setHead() 203 | { 204 | $head = new \PhpGedcom\Record\Head(); 205 | /** 206 | * @var Head\Sour 207 | */ 208 | $sour = new \PhpGedcom\Record\Head\Sour(); 209 | $sour->setSour(env('APP_NAME', '')); 210 | $sour->setVersion('1.0'); 211 | $head->setSour($sour); 212 | /** 213 | * @var string 214 | */ 215 | $dest = null; 216 | $head->setDest($dest); 217 | /** 218 | * @var Head\Date 219 | */ 220 | $date = null; 221 | $head->setDate($date); 222 | /** 223 | * @var string 224 | */ 225 | $subm = null; 226 | $head->setSubm($subm); 227 | /** 228 | * @var string 229 | */ 230 | $subn = null; 231 | $head->setSubn($subn); 232 | /** 233 | * @var string 234 | */ 235 | $file = null; 236 | $head->setFile($file); 237 | /** 238 | * @var string 239 | */ 240 | $copr = null; 241 | $head->setCopr($copr); 242 | /** 243 | * @var Head\Gedc 244 | */ 245 | $gedc = null; 246 | $head->setGedc($gedc); 247 | /** 248 | * @var Head\Char 249 | */ 250 | $char = null; 251 | $head->setChar($char); 252 | /** 253 | * @var string 254 | */ 255 | $lang = null; 256 | $head->setLang($lang); 257 | /** 258 | * @var Head\Plac 259 | */ 260 | $plac = null; 261 | $head->setPlac($plac); 262 | /** 263 | * @var string 264 | */ 265 | $note = null; 266 | $head->setNote($note); 267 | $this->_gedcom->setHead($head); 268 | } 269 | 270 | protected function setIndi($p_id, $f_id = null) 271 | { 272 | $indi = new \PhpGedcom\Record\Indi(); 273 | $person = Person::find($p_id); 274 | if ($person == null) { 275 | return; 276 | } 277 | /** 278 | * @var string 279 | */ 280 | $id = $person->id; 281 | $indi->setId($id); 282 | 283 | /** 284 | * @var string 285 | */ 286 | $uid; 287 | 288 | /** 289 | * @var string 290 | */ 291 | $chan; 292 | 293 | /** 294 | * @var Indi\Attr[] 295 | */ 296 | $attr = []; 297 | 298 | /** 299 | * @var Indi\Even[] 300 | */ 301 | $even = []; 302 | 303 | /** 304 | * @var Indi\Note[] 305 | */ 306 | $note = []; 307 | 308 | /** 309 | * @var Obje[] 310 | */ 311 | $obje = []; 312 | 313 | /** 314 | * @var Sour[] 315 | */ 316 | $sour = []; 317 | 318 | /** 319 | * @var Indi\Name[] 320 | * PhpGedcom\Record\Indi\Name 321 | */ 322 | $name = []; 323 | $_name = new \PhpGedcom\Record\Indi\Name(); 324 | $_name->setName($person->name); 325 | $indi->addName($_name); 326 | 327 | /** 328 | * @var string[] 329 | */ 330 | $alia = []; 331 | 332 | /** 333 | * @var string 334 | */ 335 | $sex = $person->sex; 336 | $indi->setSex($sex); 337 | 338 | /** 339 | * @var string 340 | */ 341 | $rin; 342 | 343 | /** 344 | * @var string 345 | */ 346 | $resn; 347 | 348 | /** 349 | * @var string 350 | */ 351 | $rfn; 352 | 353 | /** 354 | * @var string 355 | */ 356 | $afn; 357 | 358 | /** 359 | * @var Indi\Fams[] 360 | */ 361 | $fams = []; 362 | $fams = Family::where('husband_id', $p_id)->orwhere('wife_id', $p_id)->get(); 363 | foreach ($fams as $item) { 364 | $fam = new \PhpGedcom\Record\Indi\Fams(); 365 | $fam->setFams($item->id); 366 | $indi->addFams($fam); 367 | } 368 | /** 369 | * @var Indi\Famc[] 370 | */ 371 | $famc = []; 372 | 373 | /** 374 | * @var Indi\Asso[] 375 | */ 376 | $asso = []; 377 | 378 | /** 379 | * @var string[] 380 | */ 381 | $subm = []; 382 | 383 | /** 384 | * @var string[] 385 | */ 386 | $anci = []; 387 | 388 | /** 389 | * @var string[] 390 | */ 391 | $desi = []; 392 | 393 | /** 394 | * @var Refn[] 395 | */ 396 | $refn = []; 397 | 398 | /** 399 | * @var Indi\Bapl 400 | */ 401 | $bapl; 402 | 403 | /** 404 | * @var Indi\Conl 405 | */ 406 | $conl; 407 | 408 | /** 409 | * @var Indi\Endl 410 | */ 411 | $endl; 412 | 413 | /** 414 | * @var Indi\Slgc 415 | */ 416 | $slgc; 417 | $this->_gedcom->addIndi($indi); 418 | } 419 | 420 | protected function setFam($family_id) 421 | { 422 | $famData = Family::where('id', $family_id)->first(); 423 | if ($famData == null) { 424 | return; 425 | } 426 | $fam = new \PhpGedcom\Record\Fam(); 427 | $_id = $famData->id; 428 | $fam->setId($_id); 429 | 430 | $_chan = null; 431 | $fam->setChan($_chan); 432 | 433 | $_husb = $famData->husband_id; 434 | $fam->setHusb($_husb); 435 | 436 | // add husb individual 437 | // $this->setIndi($_husb, $family_id); 438 | 439 | $_wife = $famData->wife_id; 440 | $fam->setWife($_wife); 441 | 442 | // add wife individual 443 | // $this->setIndi($_wife, $family_id); 444 | 445 | $_nchi = null; 446 | $fam->setNchi($_nchi); 447 | 448 | $_chil = Person::where('child_in_family_id', $family_id)->get(); 449 | foreach ($_chil as $item) { 450 | $fam->addChil($item->id); 451 | // $this->setIndi($item->id); 452 | } 453 | 454 | $_even = []; 455 | foreach ($_even as $item) { 456 | $even = new \PhpGedcom\Record\Fam\Even(); 457 | $_type = null; // string 458 | $_date = null; // string 459 | $_plac = null; // \PhpGedcom\Record\Indi\Even\Plac 460 | $_caus = null; // string 461 | $_age = null; // string 462 | $_addr = null; // \PhpGedcom\Record\Addr 463 | $_phon = []; // \PhpGedcom\Record\Phon 464 | $_agnc = null; // string 465 | $_husb = null; // \PhpGedcom\Record\Fam\Even\Husb 466 | $_wife = null; // \PhpGedcom\Record\Fam\Even\Wife 467 | $_obje = []; // \PhpGedcom\Writer\ObjeRef 468 | $_sour = []; // \PhpGedcom\Writer\SourRef 469 | $_note = []; // \PhpGedcom\Writer\NoteRef 470 | $even->setType($_type); 471 | $even->setDate($_date); 472 | $even->setPlac($_plac); 473 | $even->setCaus($_caus); 474 | $even->setAddr($_addr); 475 | $even->setPhon($_phon); 476 | $even->setAgnc($_agnc); 477 | $even->setHusb($_husb); 478 | $even->setWife($_wife); 479 | $even->setObje($_obje); 480 | $even->setSour($_sour); 481 | $even->setNote($_note); 482 | $fam->addEven($even); 483 | } 484 | 485 | $_slgs = []; 486 | foreach ($_slgs as $item) { 487 | $slgs = new \PhpGedcom\Record\Fam\Slgs(); 488 | $_stat = null; 489 | $_date = null; 490 | $_plac = null; 491 | $_temp = null; 492 | $_sour = []; 493 | $_note = []; 494 | 495 | $slgs->setStat($_stat); 496 | $slgs->setDate($_date); 497 | $slgs->setPlac($_plac); 498 | $slgs->setTemp($_temp); 499 | $slgs->setSour($_sour); 500 | $slgs->setNote($_note); 501 | $fam->addSlgs($slgs); 502 | } 503 | 504 | $_subm = []; 505 | foreach ($_subm as $item) { 506 | $subm = new \PhpGedcom\Record\Subm(); 507 | $subm_id = null; 508 | $chan = null; // @var Record\Chan 509 | $name = null; 510 | $addr = null; //@var Record\Addr 511 | $rin = null; 512 | $rfn = null; 513 | $lang = []; 514 | $phon = []; 515 | $obje = []; 516 | $note = []; 517 | 518 | $subm->setSubm($subm_id); 519 | $subm->setChan($chan); 520 | $subm->setName($name); 521 | $subm->setAddr($addr); 522 | $subm->setRin($rin); 523 | $subm->setRfn($rfn); 524 | 525 | $subm->setLang($lang); 526 | $subm->setPhon($phon); 527 | $subm->setObje($obje); 528 | $subm->setNote($note); 529 | 530 | $fam->addSubm($subm); 531 | } 532 | 533 | $_refn = []; 534 | foreach ($_refn as $item) { 535 | $refn = new \PhpGedcom\Record\Refn(); 536 | $refn = null; 537 | $type = null; 538 | 539 | $subm->setRefn($refn); 540 | $subm->setType($type); 541 | 542 | $fam->addRefn($refn); 543 | } 544 | 545 | $_rin = null; 546 | $fam->setRin($_rin); 547 | 548 | $_note = []; 549 | foreach ($_note as $item) { 550 | $note = new \PhpGedcom\Record\NoteRef(); 551 | $fam->addNote($note); 552 | } 553 | 554 | $_sour = []; 555 | foreach ($_sour as $item) { 556 | $sour = new \PhpGedcom\Record\SourRef(); 557 | $fam->addSour($sour); 558 | } 559 | 560 | $_obje = []; 561 | foreach ($_obje as $item) { 562 | $obje = new \PhpGedcom\Record\ObjeRef(); 563 | $fam->addObje($obje); 564 | } 565 | $this->_gedcom->addFam($fam); 566 | 567 | return $fam; 568 | } 569 | 570 | protected function setSubn() 571 | { 572 | } 573 | 574 | protected function setSubM() 575 | { 576 | } 577 | 578 | protected function setSour() 579 | { 580 | } 581 | 582 | protected function setNote() 583 | { 584 | } 585 | 586 | protected function setRepo() 587 | { 588 | } 589 | 590 | protected function setObje() 591 | { 592 | } 593 | } 594 | -------------------------------------------------------------------------------- /src/Utils/GedcomParser.php: -------------------------------------------------------------------------------- 1 | conn = $conn; 38 | error_log('PARSE LOG : +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++'.$conn); 39 | $parser = new \PhpGedcom\Parser(); 40 | $gedcom = @$parser->parse($filename); 41 | // var_dump($gedcom); 42 | 43 | /** 44 | * work. 45 | */ 46 | $head = $gedcom->getHead(); 47 | $subn = $gedcom->getSubn(); 48 | $subm = $gedcom->getSubm(); 49 | $sour = $gedcom->getSour(); 50 | $note = $gedcom->getNote(); 51 | $repo = $gedcom->getRepo(); 52 | $obje = $gedcom->getObje(); 53 | 54 | /** 55 | * work end. 56 | */ 57 | $c_subn = 0; 58 | $c_subm = count($subm); 59 | $c_sour = count($sour); 60 | $c_note = count($note); 61 | $c_repo = count($repo); 62 | $c_obje = count($obje); 63 | if ($subn != null) { 64 | // 65 | $c_subn = 1; 66 | } 67 | 68 | $individuals = $gedcom->getIndi(); 69 | $families = $gedcom->getFam(); 70 | $total = count($individuals) + count($families) + $c_subn + $c_subm + $c_sour + $c_note + $c_repo + $c_obje; 71 | $complete = 0; 72 | if ($progressBar === true) { 73 | $bar = $this->getProgressBar(count($individuals) + count($families)); 74 | event(new GedComProgressSent($slug, $total, $complete)); 75 | } 76 | Log::info('Individual:'.count($individuals)); 77 | Log::info('Families:'.count($families)); 78 | Log::info('Subn:'.$c_subn); 79 | Log::info('Subm:'.$c_subm); 80 | Log::info('Sour:'.$c_sour); 81 | Log::info('Note:'.$c_note); 82 | Log::info('Repo:'.$c_repo); 83 | 84 | // store all the media objects that are contained within the GEDCOM file. 85 | foreach ($obje as $item) { 86 | // $this->getObje($item); 87 | if ($item) { 88 | $_obje_id = $item->getId(); 89 | $obje_id = \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Obje::read($this->conn, $item); 90 | if ($obje_id != 0) { 91 | $this->obje_ids[$_obje_id] = $obje_id; 92 | } 93 | } 94 | if ($progressBar === true) { 95 | $bar->advance(); 96 | $complete++; 97 | event(new GedComProgressSent($slug, $total, $complete)); 98 | } 99 | } 100 | 101 | // store information about all the submitters to the GEDCOM file. 102 | foreach ($subm as $item) { 103 | // $this->getSubm($item); 104 | if ($item) { 105 | $_subm_id = $item->getSubm(); 106 | $subm_id = \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Subm::read($this->conn, $item, null, null, $this->obje_ids); 107 | $this->subm_ids[$_subm_id] = $subm_id; 108 | } 109 | if ($progressBar === true) { 110 | $bar->advance(); 111 | $complete++; 112 | event(new GedComProgressSent($slug, $total, $complete)); 113 | } 114 | } 115 | 116 | if ($subn != null) { 117 | // store the submission information for the GEDCOM file. 118 | // $this->getSubn($subn); 119 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Subn::read($this->conn, $subn, $this->subm_ids); 120 | if ($progressBar === true) { 121 | $bar->advance(); 122 | $complete++; 123 | event(new GedComProgressSent($slug, $total, $complete)); 124 | } 125 | } 126 | 127 | // store all the notes contained within the GEDCOM file that are not inline. 128 | foreach ($note as $item) { 129 | // $this->getNote($item); 130 | if ($item) { 131 | $note_id = $item->getId(); 132 | $_note_id = \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Note::read($this->conn, $item); 133 | $this->note_ids[$note_id] = $_note_id; 134 | } 135 | 136 | if ($progressBar === true) { 137 | $bar->advance(); 138 | $complete++; 139 | event(new GedComProgressSent($slug, $total, $complete)); 140 | } 141 | } 142 | 143 | // store all repositories that are contained within the GEDCOM file and referenced by sources. 144 | foreach ($repo as $item) { 145 | // $this->getRepo($item); 146 | if ($item) { 147 | $repo_id = $item->getRepo(); 148 | $_repo_id = \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Repo::read($this->conn, $item); 149 | $this->repo_ids[$repo_id] = $_repo_id; 150 | } 151 | if ($progressBar === true) { 152 | $bar->advance(); 153 | $complete++; 154 | event(new GedComProgressSent($slug, $total, $complete)); 155 | } 156 | } 157 | 158 | // store sources cited throughout the GEDCOM file. 159 | // obje import before sour import 160 | foreach ($sour as $item) { 161 | // $this->getSour($item); 162 | if ($item) { 163 | $_sour_id = $item->getSour(); 164 | $sour_id = \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Sour::read($this->conn, $item, $this->obje_ids); 165 | if ($sour_id != 0) { 166 | $this->sour_ids[$_sour_id] = $sour_id; 167 | } 168 | } 169 | if ($progressBar === true) { 170 | $bar->advance(); 171 | $complete++; 172 | event(new GedComProgressSent($slug, $total, $complete)); 173 | } 174 | } 175 | 176 | foreach ($individuals as $individual) { 177 | $this->getPerson($individual); 178 | if ($progressBar === true) { 179 | $bar->advance(); 180 | $complete++; 181 | event(new GedComProgressSent($slug, $total, $complete)); 182 | } 183 | } 184 | 185 | // complete person-alia and person-asso table with person table 186 | $alia_list = PersonAlia::on($conn)->where('group', 'indi')->where('import_confirm', 0)->get(); 187 | foreach ($alia_list as $item) { 188 | $alia = $item->alia; 189 | if (isset($this->person_ids[$alia])) { 190 | $item->alia = $this->person_ids[$alia]; 191 | $item->import_confirm = 1; 192 | $item->save(); 193 | } else { 194 | $item->delete(); 195 | } 196 | } 197 | 198 | $asso_list = PersonAsso::on($conn)->where('group', 'indi')->where('import_confirm', 0)->get(); 199 | foreach ($asso_list as $item) { 200 | $_indi = $item->indi; 201 | if (isset($this->person_ids[$_indi])) { 202 | $item->indi = $this->person_ids[$_indi]; 203 | $item->import_confirm = 1; 204 | $item->save(); 205 | } else { 206 | $item->delete(); 207 | } 208 | } 209 | 210 | foreach ($families as $family) { 211 | $this->getFamily($family); 212 | if ($progressBar === true) { 213 | $bar->advance(); 214 | $complete++; 215 | event(new GedComProgressSent($slug, $total, $complete)); 216 | } 217 | } 218 | 219 | if ($progressBar === true) { 220 | //Record end time and calculate total execution time 221 | $time_end = microtime(true); 222 | $execution_time = ($time_end - $time_start); 223 | error_log("\nTotal Execution Time: ".round($execution_time).' Seconds'); 224 | 225 | $bar->finish(); 226 | } 227 | } 228 | 229 | private function getProgressBar(int $max) 230 | { 231 | return (new OutputStyle( 232 | new StringInput(''), 233 | new StreamOutput(fopen('php://stdout', 'w')) 234 | ))->createProgressBar($max); 235 | } 236 | 237 | private function getPerson($individual) 238 | { 239 | $g_id = $individual->getId(); 240 | $name = ''; 241 | $givn = ''; 242 | $surn = ''; 243 | 244 | $name = ''; 245 | $npfx = ''; 246 | $givn = ''; 247 | $nick = ''; 248 | $spfx = ''; 249 | $surn = ''; 250 | $nsfx = ''; 251 | $type = ''; 252 | $fone = null; // PhpGedcom/ 253 | $romn = null; 254 | $names = $individual->getName(); 255 | 256 | if (!empty($names)) { 257 | $name = current($names)->getName(); 258 | $npfx = current($names)->getNpfx(); 259 | $givn = current($names)->getGivn(); 260 | $nick = current($names)->getNick(); 261 | $spfx = current($names)->getSpfx(); 262 | $surn = current($names)->getSurn(); 263 | $nsfx = current($names)->getNsfx(); 264 | $type = current($names)->getType(); 265 | } 266 | 267 | // array value 268 | $fams = $individual->getFams(); // self family, leave it now, note would be included in family 269 | $famc = $individual->getFamc(); // parent family , leave it now, note and pedi would be included in family 270 | 271 | // added to database 272 | // string value 273 | $sex = preg_replace('/[^MF]/', '', $individual->getSex()); 274 | $uid = $individual->getUid(); 275 | $resn = $individual->getResn(); 276 | $rin = $individual->getRin(); 277 | $rfn = $individual->getRfn(); 278 | $afn = $individual->getAfn(); 279 | 280 | $attr = $individual->getAllAttr(); 281 | $events = $individual->getAllEven(); 282 | $note = $individual->getNote(); 283 | $indv_sour = $individual->getSour(); 284 | $alia = $individual->getAlia(); // string array 285 | $asso = $individual->getAsso(); 286 | $subm = $individual->getSubm(); 287 | $anci = $individual->getAnci(); 288 | $desi = $individual->getDesi(); 289 | $refn = $individual->getRefn(); // \PhpGedcom\Record\Refn array 290 | $obje = $individual->getObje(); 291 | // object 292 | $bapl = $individual->getBapl(); 293 | $conl = $individual->getConl(); 294 | $endl = $individual->getEndl(); 295 | $slgc = $individual->getSlgc(); 296 | 297 | $chan = $individual->getChan(); 298 | 299 | if ($givn == '') { 300 | $givn = $name; 301 | } 302 | $config = json_encode(config('database.connections.'.$this->conn)); 303 | $person = Person::on($this->conn)->updateOrCreate(compact('name', 'givn', 'surn', 'sex'), compact('name', 'givn', 'surn', 'sex', 'uid', 'rin', 'resn', 'rfn', 'afn')); 304 | $this->persons_id[$g_id] = $person->id; 305 | if ($events !== null) { 306 | foreach ($events as $event) { 307 | if ($event && count($event) > 0) { 308 | $e_data = $event[0]; 309 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Indi\Even::read($this->conn, $e_data, $person, $this->obje_ids); 310 | } 311 | } 312 | } 313 | 314 | if ($attr !== null) { 315 | foreach ($attr as $event) { 316 | $e_data = $event[0]; 317 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Indi\Even::read($this->conn, $e_data, $person); 318 | } 319 | } 320 | 321 | $_group = 'indi'; 322 | $_gid = $person->id; 323 | if ($names != null && count($names) > 0) { 324 | foreach ($names as $item) { 325 | if ($item) { 326 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Indi\Name::read($this->conn, $item, $_group, $_gid); 327 | } 328 | } 329 | } 330 | if ($note != null && count($note) > 0) { 331 | foreach ($note as $item) { 332 | if ($item) { 333 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\NoteRef::read($this->conn, $item, $_group, $_gid); 334 | } 335 | } 336 | } 337 | if ($indv_sour != null && count($indv_sour) > 0) { 338 | foreach ($indv_sour as $item) { 339 | if ($item) { 340 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\SourRef::read($this->conn, $item, $_group, $_gid, $this->sour_ids, $this->obje_ids); 341 | } 342 | } 343 | } 344 | 345 | // ?? 346 | if ($alia && count($alia) > 0) { 347 | foreach ($alia as $item) { 348 | if ($item) { 349 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Indi\Alia::read($this->conn, $item, $_group, $_gid); 350 | } 351 | } 352 | } 353 | // ?? 354 | if ($asso && count($asso) > 0) { 355 | foreach ($asso as $item) { 356 | if ($item) { 357 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Indi\Asso::read($this->conn, $item, $_group, $_gid); 358 | } 359 | } 360 | } 361 | 362 | if ($subm && count($subm) > 0) { 363 | foreach ($subm as $item) { 364 | if ($item) { 365 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Indi\Subm::read($this->conn, $item, $_group, $_gid, $this->subm_ids); 366 | } 367 | } 368 | } 369 | 370 | if ($anci && count($anci) > 0) { 371 | foreach ($anci as $item) { 372 | if ($item) { 373 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Indi\Anci::read($this->conn, $item, $_group, $_gid, $this->subm_ids); 374 | } 375 | } 376 | } 377 | 378 | if ($desi && count($desi) > 0) { 379 | foreach ($desi as $item) { 380 | if ($item) { 381 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Indi\Desi::read($this->conn, $item, $_group, $_gid, $this->subm_ids); 382 | } 383 | } 384 | } 385 | 386 | if ($refn && count($refn) > 0) { 387 | foreach ($refn as $item) { 388 | if ($item) { 389 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Refn::read($this->conn, $item, $_group, $_gid); 390 | } 391 | } 392 | } 393 | 394 | if ($obje && count($obje) > 0) { 395 | foreach ($obje as $item) { 396 | if ($item) { 397 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\ObjeRef::read($this->conn, $item, $_group, $_gid, $this->obje_ids); 398 | } 399 | } 400 | } 401 | 402 | if ($bapl && count($bapl) > 0) { 403 | foreach ($bapl as $item) { 404 | if ($item) { 405 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Indi\Lds::read($this->conn, $item, $_group, $_gid, 'BAPL', $this->sour_ids, $this->obje_ids); 406 | } 407 | } 408 | } 409 | 410 | if ($conl && count($conl) > 0) { 411 | foreach ($conl as $item) { 412 | if ($item) { 413 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Indi\Lds::read($this->conn, $item, $_group, $_gid, 'CONL', $this->sour_ids, $this->obje_ids); 414 | } 415 | } 416 | } 417 | 418 | if ($endl && count($endl) > 0) { 419 | foreach ($endl as $item) { 420 | if ($item) { 421 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Indi\Lds::read($this->conn, $item, $_group, $_gid, 'ENDL', $this->sour_ids, $this->obje_ids); 422 | } 423 | } 424 | } 425 | 426 | if ($slgc && count($slgc) > 0) { 427 | foreach ($slgc as $item) { 428 | if ($item) { 429 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Indi\Lds::read($this->conn, $item, $_group, $_gid, 'SLGC', $this->sour_ids, $this->obje_ids); 430 | } 431 | } 432 | } 433 | if ($chan) { 434 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Chan::read($this->conn, $chan, $_group, $_gid); 435 | } 436 | } 437 | 438 | private function getFamily($family) 439 | { 440 | $g_id = $family->getId(); 441 | $resn = $family->getResn(); 442 | $husb = $family->getHusb(); 443 | $wife = $family->getWife(); 444 | 445 | // string 446 | $nchi = $family->getNchi(); 447 | $rin = $family->getRin(); 448 | 449 | // array 450 | $subm = $family->getSubm(); 451 | $_slgs = $family->getSlgs(); 452 | 453 | $description = null; 454 | $type_id = 0; 455 | 456 | $children = $family->getChil(); 457 | $events = $family->getAllEven(); 458 | $_note = $family->getNote(); 459 | $_obje = $family->getObje(); 460 | $_sour = $family->getSour(); 461 | $_refn = $family->getRefn(); 462 | 463 | // object 464 | $chan = $family->getChan(); 465 | 466 | $husband_id = (isset($this->persons_id[$husb])) ? $this->persons_id[$husb] : 0; 467 | $wife_id = (isset($this->persons_id[$wife])) ? $this->persons_id[$wife] : 0; 468 | 469 | $family = Family::on($this->conn)->updateOrCreate( 470 | compact('husband_id', 'wife_id'), 471 | compact('husband_id', 'wife_id', 'description', 'type_id', 'nchi', 'rin') 472 | ); 473 | 474 | if ($children !== null) { 475 | foreach ($children as $child) { 476 | if (isset($this->persons_id[$child])) { 477 | $person = Person::on($this->conn)->find($this->persons_id[$child]); 478 | $person->child_in_family_id = $family->id; 479 | $person->save(); 480 | } 481 | } 482 | } 483 | 484 | if ($events !== null && count($events) > 0) { 485 | foreach ($events as $item) { 486 | if ($item) { 487 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Fam\Even::read($this->conn, $item, $family, $this->obje_ids); 488 | } 489 | // $date = $this->getDate($item->getDate()); 490 | // $place = $this->getPlace($item->getPlac()); 491 | // $family->addEvent($item->getType(), $date, $place); 492 | } 493 | } 494 | $_group = 'fam'; 495 | $_gid = $family->id; 496 | if ($_note != null && count($_note) > 0) { 497 | foreach ($_note as $item) { 498 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\NoteRef::read($this->conn, $item, $_group, $_gid); 499 | } 500 | } 501 | if ($_obje && count($_obje) > 0) { 502 | foreach ($_obje as $item) { 503 | if ($item) { 504 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\ObjeRef::read($this->conn, $item, $_group, $_gid, $this->obje_ids); 505 | } 506 | } 507 | } 508 | if ($_refn && count($_refn) > 0) { 509 | foreach ($_refn as $item) { 510 | if ($item) { 511 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Refn::read($this->conn, $item, $_group, $_gid); 512 | } 513 | } 514 | } 515 | if ($_sour && count($_sour) > 0) { 516 | foreach ($_sour as $item) { 517 | if ($item) { 518 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\SourRef::read($this->conn, $item, $_group, $_gid, $this->sour_ids, $this->obje_ids); 519 | } 520 | } 521 | } 522 | if ($_slgs && count($_slgs) > 0) { 523 | foreach ($_slgs as $item) { 524 | if ($item) { 525 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Fam\Slgs::read($this->conn, $item, $family); 526 | } 527 | } 528 | } 529 | if ($subm && count($subm) > 0) { 530 | foreach ($subm as $item) { 531 | if ($item) { 532 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Subm::read($this->conn, $item, $_group, $_gid, $this->obje_ids); 533 | } 534 | } 535 | } 536 | if ($chan) { 537 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Chan::read($this->conn, $chan, 'family', $family->id); 538 | } 539 | } 540 | } 541 | -------------------------------------------------------------------------------- /src/Utils/GedcomWriter.php: -------------------------------------------------------------------------------- 1 | parse($filename); 33 | 34 | /** 35 | * work. 36 | */ 37 | $head = $gedcom->getHead(); 38 | $subn = $gedcom->getSubn(); 39 | $subm = $gedcom->getSubm(); 40 | $sour = $gedcom->getSour(); 41 | $note = $gedcom->getNote(); 42 | $repo = $gedcom->getRepo(); 43 | $obje = $gedcom->getObje(); 44 | 45 | /** 46 | * work end. 47 | */ 48 | $c_subn = 0; 49 | $c_subm = count($subm); 50 | $c_sour = count($sour); 51 | $c_note = count($note); 52 | $c_repo = count($repo); 53 | $c_obje = count($obje); 54 | if ($subn != null) { 55 | // 56 | $c_subn = 1; 57 | } 58 | 59 | $individuals = $gedcom->getIndi(); 60 | $families = $gedcom->getFam(); 61 | $total = count($individuals) + count($families) + $c_subn + $c_subm + $c_sour + $c_note + $c_repo + $c_obje; 62 | $complete = 0; 63 | if ($progressBar === true) { 64 | $bar = $this->getProgressBar(count($individuals) + count($families)); 65 | event(new GedComProgressSent($slug, $total, $complete)); 66 | } 67 | 68 | if ($subn != null) { 69 | // store the submission information for the GEDCOM file. 70 | $this->getSubn($subn); 71 | if ($progressBar === true) { 72 | $bar->advance(); 73 | $complete++; 74 | event(new GedComProgressSent($slug, $total, $complete)); 75 | } 76 | } 77 | 78 | // store information about all the submitters to the GEDCOM file. 79 | foreach ($subm as $item) { 80 | $this->getSubm($item); 81 | if ($progressBar === true) { 82 | $bar->advance(); 83 | $complete++; 84 | event(new GedComProgressSent($slug, $total, $complete)); 85 | } 86 | } 87 | 88 | // store sources cited throughout the GEDCOM file. 89 | foreach ($sour as $item) { 90 | $this->getSour($item); 91 | if ($progressBar === true) { 92 | $bar->advance(); 93 | $complete++; 94 | event(new GedComProgressSent($slug, $total, $complete)); 95 | } 96 | } 97 | 98 | // store all the notes contained within the GEDCOM file that are not inline. 99 | foreach ($note as $item) { 100 | $this->getNote($item); 101 | if ($progressBar === true) { 102 | $bar->advance(); 103 | $complete++; 104 | event(new GedComProgressSent($slug, $total, $complete)); 105 | } 106 | } 107 | 108 | // store all repositories that are contained within the GEDCOM file and referenced by sources. 109 | foreach ($repo as $item) { 110 | $this->getRepo($item); 111 | if ($progressBar === true) { 112 | $bar->advance(); 113 | $complete++; 114 | event(new GedComProgressSent($slug, $total, $complete)); 115 | } 116 | } 117 | // store all the media objects that are contained within the GEDCOM file. 118 | foreach ($obje as $item) { 119 | $this->getObje($item); 120 | if ($progressBar === true) { 121 | $bar->advance(); 122 | $complete++; 123 | event(new GedComProgressSent($slug, $total, $complete)); 124 | } 125 | } 126 | 127 | foreach ($individuals as $individual) { 128 | $this->getPerson($individual); 129 | if ($progressBar === true) { 130 | $bar->advance(); 131 | $complete++; 132 | event(new GedComProgressSent($slug, $total, $complete)); 133 | } 134 | } 135 | 136 | foreach ($families as $family) { 137 | $this->getFamily($family); 138 | if ($progressBar === true) { 139 | $bar->advance(); 140 | $complete++; 141 | event(new GedComProgressSent($slug, $total, $complete)); 142 | } 143 | } 144 | 145 | if ($progressBar === true) { 146 | $bar->finish(); 147 | } 148 | } 149 | 150 | private function getProgressBar(int $max) 151 | { 152 | return (new OutputStyle( 153 | new StringInput(''), 154 | new StreamOutput(fopen('php://stdout', 'w')) 155 | ))->createProgressBar($max); 156 | } 157 | 158 | private function getDate($input_date) 159 | { 160 | return "$input_date"; 161 | } 162 | 163 | private function getPlace($place) 164 | { 165 | if (is_object($place)) { 166 | $place = $place->getPlac(); 167 | } 168 | 169 | return $place; 170 | } 171 | 172 | private function getPerson($individual) 173 | { 174 | $g_id = $individual->getId(); 175 | $name = ''; 176 | $givn = ''; 177 | $surn = ''; 178 | 179 | if (!empty($individual->getName())) { 180 | $surn = current($individual->getName())->getSurn(); 181 | $givn = current($individual->getName())->getGivn(); 182 | $name = current($individual->getName())->getName(); 183 | } 184 | 185 | // string value 186 | $uid = $individual->getUid(); 187 | $chan = $individual->getChan(); 188 | $rin = $individual->getRin(); 189 | $resn = $individual->getResn(); 190 | $rfn = $individual->getRfn(); 191 | $afn = $individual->getAfn(); 192 | 193 | // array value 194 | $note = $individual->getNote(); 195 | $obje = $individual->getObje(); 196 | $sour = $individual->getSour(); 197 | $fams = $individual->getFams(); 198 | $famc = $individual->getFamc(); 199 | $alia = $individual->getAlia(); 200 | $asso = $individual->getAsso(); 201 | $subm = $individual->getSubm(); 202 | $anci = $individual->getAnci(); 203 | $desi = $individual->getDesi(); 204 | $refn = $individual->getRefn(); 205 | 206 | // object 207 | $bapl = $individual->getBapl(); 208 | $conl = $individual->getConl(); 209 | $endl = $individual->getEndl(); 210 | $slgc = $individual->getSlgc(); 211 | 212 | $sex = preg_replace('/[^MF]/', '', $individual->getSex()); 213 | $attr = $individual->getAllAttr(); 214 | $events = $individual->getAllEven(); 215 | 216 | if ($givn == '') { 217 | $givn = $name; 218 | } 219 | $person = Person::updateOrCreate(compact('name', 'givn', 'surn', 'sex'), compact('name', 'givn', 'surn', 'sex', 'uid', 'chan', 'rin', 'resn', 'rfn', 'afn')); 220 | $this->persons_id[$g_id] = $person->id; 221 | 222 | if ($events !== null) { 223 | foreach ($events as $event) { 224 | $date = $this->getDate($event->getDate()); 225 | $place = $this->getPlace($event->getPlac()); 226 | $person->addEvent($event->getType(), $date, $place); 227 | } 228 | } 229 | 230 | if ($attr !== null) { 231 | foreach ($attr as $event) { 232 | $date = $this->getDate($event->getDate()); 233 | $place = $this->getPlace($event->getPlac()); 234 | if (count($event->getNote()) > 0) { 235 | $note = current($event->getNote())->getNote(); 236 | } else { 237 | $note = ''; 238 | } 239 | $person->addEvent($event->getType(), $date, $place, $event->getAttr().' '.$note); 240 | } 241 | } 242 | } 243 | 244 | private function getFamily($family) 245 | { 246 | $g_id = $family->getId(); 247 | $husb = $family->getHusb(); 248 | $wife = $family->getWife(); 249 | 250 | // string 251 | $chan = $family->getChan(); 252 | $nchi = $family->getNchi(); 253 | 254 | // array 255 | $_slgs = $family->getSlgs(); 256 | $_subm = $family->getSubm(); 257 | $_refn = $family->getRefn(); 258 | $_rin = $family->getRin(); 259 | $_note = $family->getNote(); 260 | $_sour = $family->getSour(); 261 | $_obje = $family->getObje(); 262 | 263 | $description = null; 264 | $type_id = 0; 265 | $children = $family->getChil(); 266 | $events = $family->getAllEven(); 267 | 268 | $husband_id = (isset($this->persons_id[$husb])) ? $this->persons_id[$husb] : 0; 269 | $wife_id = (isset($this->persons_id[$wife])) ? $this->persons_id[$wife] : 0; 270 | 271 | $family = Family::updateOrCreate(compact('husband_id', 'wife_id'), compact('husband_id', 'wife_id', 'description', 'type_id', 'chan', 'nchi')); 272 | 273 | if ($children !== null) { 274 | foreach ($children as $child) { 275 | if (isset($this->persons_id[$child])) { 276 | $person = Person::find($this->persons_id[$child]); 277 | $person->child_in_family_id = $family->id; 278 | $person->save(); 279 | } 280 | } 281 | } 282 | 283 | if ($events !== null) { 284 | foreach ($events as $event) { 285 | $date = $this->getDate($event->getDate()); 286 | $place = $this->getPlace($event->getPlac()); 287 | $family->addEvent($event->getType(), $date, $place); 288 | } 289 | } 290 | } 291 | 292 | private function getSubn($subn) 293 | { 294 | $subm = $subn->getSubm(); 295 | $famf = $subn->getFamf(); 296 | $temp = $subn->getTemp(); 297 | $ance = $subn->getAnce(); 298 | $desc = $subn->getDesc(); 299 | $ordi = $subn->getOrdi(); 300 | $rin = $subn->getRin(); 301 | $_subn = Subn::updateOrCreate(compact('subm', 'famf', 'temp', 'ance', 'desc', 'ordi', 'rin'), compact('subm', 'famf', 'temp', 'ance', 'desc', 'ordi', 'rin')); 302 | } 303 | 304 | // insert subm data to model 305 | private function getSubm($_subm) 306 | { 307 | $subm = $_subm->getSubm() ?? 'Unknown'; // string 308 | $chan = $_subm->getChan() ?? ['Unknown']; // Record\Chan--- 309 | $name = $_subm->getName() ?? 'Unknown'; // string 310 | if ($_subm->getAddr() != null) { // Record/Addr 311 | $addr = $_subm->getAddr(); 312 | $addr->getAddr() ?? 'Unknown'; 313 | $addr->getAdr1() ?? 'Unknown'; 314 | $addr->getAdr2() ?? 'Unknown'; 315 | $addr->getCity() ?? 'Unknown'; 316 | $addr->getStae() ?? 'Unknown'; 317 | $addr->getCtry() ?? 'Unknown'; 318 | } else { 319 | $addr = null; 320 | } 321 | 322 | $rin = $_subm->getRin() ?? 'Unknown'; // string 323 | $rfn = $_subm->getRfn() ?? 'Unknown'; // string 324 | $_lang = $_subm->getLang() ?? ['Unknown']; // array 325 | $_phon = $_subm->getPhon() ?? ['Unknown']; // array 326 | $obje = $_subm->getObje() ?? ['Unknown']; // array --- 327 | 328 | // create chan model - id, ref_type (subm), date, time 329 | // create note model - id, ref_type ( chan ), note 330 | // create sour model - id, ref_type ( note), sour, Chan, titl, auth, data, text, publ, Repo, abbr, rin, refn_a, Note_a, Obje_a 331 | // $arr_chan = array('date'=>$chan->getDate(), 'time'=>$chan->getTime()); 332 | // create obje model - id, _isRef, _obje, _form, _titl, _file, _Note_a 333 | 334 | if ($addr != null) { 335 | $arr_addr = [ 336 | 'addr' => $_addr->getAddr() ?? 'Unknown', 337 | 'adr1' => $_addr->getAdr1() ?? 'Unknown', 338 | 'adr2' => $_addr->getAdr2() ?? 'Unknown', 339 | 'city' => $_addr->getCity() ?? 'Unknown', 340 | 'stae' => $_addr->getStae() ?? 'Unknown', 341 | 'ctry' => $_addr->getCtry() ?? 'Unknown', 342 | ]; 343 | } else { 344 | $arr_addr = [ 345 | 'addr' => 'Unknown', 346 | 'adr1' => 'Unknown', 347 | 'adr2' => 'Unknown', 348 | 'city' => 'Unknown', 349 | 'stae' => 'Unknown', 350 | 'ctry' => 'Unknown', 351 | ]; 352 | } 353 | 354 | $addr = json_encode($arr_addr); 355 | $lang = json_encode($_lang); 356 | $arr_phon = []; 357 | foreach ($_phon as $item) { 358 | $__phon = $item->getPhon(); 359 | array_push($arr_phon, $__phon); 360 | } 361 | $phon = json_encode($arr_phon); 362 | Subm::updateOrCreate(compact('subm', 'name', 'addr', 'rin', 'rfn', 'lang', 'phon'), compact('subm', 'name', 'addr', 'rin', 'rfn', 'lang', 'phon')); 363 | } 364 | 365 | // insert sour data to database 366 | private function getSour($_sour) 367 | { 368 | $sour = $_sour->getSour(); // string 369 | $chan = $_sour->getChan(); // Record/Chan 370 | $titl = $_sour->getTitl(); // string 371 | $auth = $_sour->getAuth(); // string 372 | $data = $_sour->getData(); // string 373 | $text = $_sour->getText(); // string 374 | $publ = $_sour->getPubl(); // string 375 | $repo = $_sour->getRepo(); // Repo 376 | $abbr = $_sour->getAbbr(); // string 377 | $rin = $_sour->getRin(); // string 378 | $refn = $_sour->getRefn(); // array 379 | $note = $_sour->getNote(); // array 380 | $obje = $_sour->getObje(); // array 381 | Source::updateOrCreate(compact('sour', 'titl', 'auth', 'data', 'text', 'publ', 'abbr'), compact('sour', 'titl', 'auth', 'data', 'text', 'publ', 'abbr')); 382 | } 383 | 384 | // insert note data to database 385 | private function getNote($_note) 386 | { 387 | $gid = $_note->getId(); // string 388 | $note = $_note->getNote(); // string 389 | $chan = $_note->getChan(); // string ? 390 | $even = $_note->getEven(); // string ? 391 | $refn = $_note->getRefn(); // array 392 | $rin = $_note->getRin(); // string 393 | $sour = $_note->getSour(); // array 394 | Note::updateOrCreate(compact('gid', 'note', 'rin'), compact('gid', 'note', 'rin')); 395 | } 396 | 397 | // insert repo data to database 398 | private function getRepo($_repo) 399 | { 400 | $repo = $_repo->getRepo(); // string 401 | $name = $_repo->getName(); // string 402 | $_addr = $_repo->getAddr(); // Record/Addr 403 | $rin = $_repo->getRin(); // string 404 | $chan = $_repo->getChan(); // Record / Chan -- 405 | $_phon = $_repo->getPhon(); // array 406 | $refn = $_repo->getRefn(); // array -- 407 | $note = $_repo->getNote(); // array -- 408 | $arr_addr = [ 409 | 'addr' => $_addr->getAddr(), 410 | 'adr1' => $_addr->getAdr1(), 411 | 'adr2' => $_addr->getAdr2(), 412 | 'city' => $_addr->getCity(), 413 | 'stae' => $_addr->getStae(), 414 | 'ctry' => $_addr->getCtry(), 415 | ]; 416 | $addr = json_encode($arr_addr); 417 | $arr_phon = []; 418 | foreach ($_phon as $item) { 419 | $__phon = $item->getPhon(); 420 | array_push($arr_phon, $__phon); 421 | } 422 | $phon = json_encode($arr_phon); 423 | Repository::updateOrCreate(compact('repo', 'name', 'addr', 'rin', 'phon'), compact('repo', 'name', 'addr', 'rin', 'phon')); 424 | } 425 | 426 | // insert obje data to database 427 | private function getObje($_obje) 428 | { 429 | $gid = $_obje->getId(); // string 430 | $_form = $_obje->getForm(); // string 431 | $_titl = $_obje->getTitl(); // string 432 | $_blob = $_obje->getBlob(); // string 433 | $_rin = $_obje->getRin(); // string 434 | $_chan = $_obje->getChan(); // Chan 435 | $_file = $_obje->getFile(); // string 436 | MediaObject::updateOrCreate(compact('gid', 'form', 'titl', 'blob', 'rin', 'file'), compact('gid', 'form', 'titl', 'blob', 'rin', 'file')); 437 | } 438 | } 439 | -------------------------------------------------------------------------------- /src/Utils/Importer/Addr.php: -------------------------------------------------------------------------------- 1 | getAdr1(); 21 | $adr2 = $addr->getAdr2(); 22 | $city = $addr->getCity(); 23 | $stae = $addr->getStae(); 24 | $post = $addr->getPost(); 25 | $ctry = $addr->getCtry(); 26 | 27 | $addr = MAddr::on($conn)->where([ 28 | ['adr1', '=', $adr1], 29 | ['adr2', '=', $adr2], 30 | ['city', '=', $city], 31 | 32 | ['stae', '=', $stae], 33 | ['post', '=', $post], 34 | ['ctry', '=', $ctry], 35 | ])->first(); 36 | if ($addr !== null) { 37 | $id = $addr->id; 38 | } else { 39 | $addr = MAddr::on($conn)->create(compact('adr1', 'adr2', 'city', 'stae', 'post', 'ctry')); 40 | $id = $addr->id; 41 | } 42 | 43 | return $id; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Utils/Importer/Caln.php: -------------------------------------------------------------------------------- 1 | getMedi(); 19 | 20 | $key = [ 21 | 'group'=> $group, 22 | 'gid' => $gid, 23 | 'medi' => $medi, 24 | ]; 25 | $data = [ 26 | 'group'=> $group, 27 | 'gid' => $gid, 28 | 'medi' => $medi, 29 | ]; 30 | $_caln = MCaln::on($conn)->updateOrCreate($key, $data); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Utils/Importer/Chan.php: -------------------------------------------------------------------------------- 1 | getDate(); 17 | $time = $chan->getTime(); 18 | 19 | // store chan 20 | $key = ['group'=>$group, 'gid'=>$group_id, 'date'=>$date, 'time'=>$time]; 21 | $data = ['group'=>$group, 'gid'=>$group_id, 'date'=>$date, 'time'=>$time]; 22 | $record = MChan::on($conn)->updateOrCreate($key, $data); 23 | 24 | // store Sources of Note 25 | $_group = 'chan'; 26 | $_gid = $record->id; 27 | // SourRef array 28 | $note = $chan->getNote(); 29 | if ($note && count($note) > 0) { 30 | foreach ($note as $item) { 31 | if ($item) { 32 | NoteRef::read($conn, $item, $_group, $_gid); 33 | } 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Utils/Importer/Date.php: -------------------------------------------------------------------------------- 1 | getDate(); 19 | } 20 | } else { 21 | return "$input_date"; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Utils/Importer/Fam/Even.php: -------------------------------------------------------------------------------- 1 | getType(); 24 | $_date = $even->getDate(); 25 | $date = \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Date::read($conn, $_date); 26 | $_plac = $even->getPlac(); 27 | $plac = \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Indi\Even\Plac::read($conn, $_plac); 28 | 29 | $_phon = $even->getPhon(); 30 | $phon = \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Phon::read($conn, $_phon); 31 | 32 | $_addr = $even->getAddr(); 33 | $addr_id = \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Addr::read($conn, $_addr); 34 | 35 | $caus = $even->getCaus(); 36 | $age = $even->getAge(); 37 | $agnc = $even->getAgnc(); 38 | 39 | $fam_id = $fam->id; 40 | $husb_id = $fam->husband_id; 41 | $wife_id = $fam->wife_id; 42 | 43 | // update husb age 44 | $_husb = $even->getHusb(); 45 | if ($_husb) { 46 | $husb = Person::on($conn)->find($husb_id); 47 | if ($husb) { 48 | $husb->age = $_husb->getAge(); 49 | $husb->save(); 50 | } 51 | } 52 | 53 | // update wife age 54 | $_wife = $even->getWife(); 55 | if ($_wife) { 56 | $wife = Person::on($conn)->find($wife_id); 57 | if ($wife) { 58 | $wife->age = $_wife->getAge(); 59 | $wife->save(); 60 | } 61 | } 62 | 63 | switch ($class_name) { 64 | case 'Even': 65 | break; 66 | case 'Anul': 67 | break; 68 | case 'Cens': 69 | break; 70 | case 'Div': 71 | break; 72 | case 'Divf': 73 | break; 74 | case 'Enga': 75 | break; 76 | case 'Marr': 77 | break; 78 | case 'Marb': 79 | break; 80 | case 'Marc': 81 | break; 82 | case 'Marl': 83 | break; 84 | case 'Mars': 85 | break; 86 | default: 87 | } 88 | $adop = ''; 89 | $adop_famc = ''; 90 | $birt_famc = ''; 91 | // store Fam/Even 92 | $key = [ 93 | 'family_id'=> $fam_id, 94 | 'title' => $class_name, 95 | 'type' => $type, 96 | 'date' => $date, 97 | 'plac' => $plac, 98 | 'phon' => $phon, 99 | 'caus' => $caus, 100 | 'age' => $age, 101 | 'agnc' => $agnc, 102 | 'husb' => $husb_id, 103 | 'wife' => $wife_id, 104 | ]; 105 | $data = [ 106 | 'family_id'=> $fam_id, 107 | 'title' => $class_name, 108 | 'type' => $type, // 109 | 'date' => $date, 110 | 'plac' => $plac, // 111 | 'addr_id' => $addr_id, // 112 | 'phon' => $phon, // 113 | 'caus' => $caus, // 114 | 'age' => $age, // 115 | 'agnc' => $agnc, // 116 | 'husb' => $husb_id, // 117 | 'wife' => $wife_id, // 118 | ]; 119 | $record = FamilyEvent::on($conn)->updateOrCreate($key, $data); 120 | 121 | $_group = 'fam_even'; 122 | $_gid = $record->id; 123 | 124 | // array 125 | $sour = $even->getSour(); 126 | if ($sour && count($sour) > 0) { 127 | foreach ($sour as $item) { 128 | if ($item) { 129 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\SourRef::read($conn, $item, $_group, $_gid); 130 | } 131 | } 132 | } 133 | $obje = $even->getObje(); 134 | if ($obje && count($obje) > 0) { 135 | foreach ($obje as $item) { 136 | if ($item) { 137 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\ObjeRef::read($conn, $item, $_group, $_gid, $obje_ids); 138 | } 139 | } 140 | } 141 | $notes = $even->getNote(); 142 | if ($notes && count($notes) > 0) { 143 | foreach ($notes as $item) { 144 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\NoteRef::read($conn, $item, $_group, $_gid); 145 | } 146 | } 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /src/Utils/Importer/Fam/Slgs.php: -------------------------------------------------------------------------------- 1 | getStat(); 23 | $date = $slgs->getDate(); 24 | $plac = $slgs->getPlac(); 25 | $temp = $slgs->getTemp(); 26 | 27 | $key = [ 28 | 'family_id'=> $fam->id, 29 | 'stat' => $stat, 30 | 'date' => $date, 31 | 'plac' => $plac, 32 | 'temp' => $temp, 33 | ]; 34 | $data = [ 35 | 'family_id'=> $fam->id, 36 | 'stat' => $stat, 37 | 'date' => $date, 38 | 'plac' => $plac, 39 | 'temp' => $temp, 40 | ]; 41 | 42 | $record = FamilySlgs::on($conn)->updateOrCreate($key, $data); 43 | 44 | $_group = 'fam_slgs'; 45 | $_gid = $record->id; 46 | 47 | // array 48 | $sour = $slgs->getSour(); 49 | if ($sour && count($sour) > 0) { 50 | foreach ($sour as $item) { 51 | if ($item) { 52 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\SourRef::read($conn, $item, $_group, $_gid); 53 | } 54 | } 55 | } 56 | 57 | $note = $slgs->getNote(); 58 | if ($note && count($note) > 0) { 59 | foreach ($note as $item) { 60 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\NoteRef::read($conn, $item, $_group, $_gid); 61 | } 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/Utils/Importer/Indi/Alia.php: -------------------------------------------------------------------------------- 1 | $group, 'gid'=>$group_id, 'alia'=>$alia]; 18 | $data = ['group'=>$group, 'gid'=>$group_id, 'alia'=>$alia]; 19 | $record = PersonAlia::on($conn)->updateOrCreate($key, $data); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Utils/Importer/Indi/Anci.php: -------------------------------------------------------------------------------- 1 | $group, 'gid'=>$group_id, 'anci'=>$subm_id]; 20 | $data = ['group'=>$group, 'gid'=>$group_id, 'anci'=>$subm_id]; 21 | $record = PersonAnci::on($conn)->updateOrCreate($key, $data); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Utils/Importer/Indi/Asso.php: -------------------------------------------------------------------------------- 1 | getIndi(); 18 | $rela = $asso->getRela(); 19 | 20 | // store asso 21 | $key = ['group'=>$group, 'gid'=>$group_id, 'rela'=>$rela, 'indi' => $_indi]; 22 | $data = ['group'=>$group, 'gid'=>$group_id, 'rela'=>$rela, 'indi' => $_indi]; 23 | $record = PersonAsso::on($conn)->updateOrCreate($key, $data); 24 | 25 | $_group = 'indi_asso'; 26 | $_gid = $record->id; 27 | // store Note 28 | $note = $asso->getNote(); 29 | if ($note && count($note) > 0) { 30 | foreach ($note as $item) { 31 | if ($item) { 32 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\NoteRef::read($conn, $item, $_group, $_gid); 33 | } 34 | } 35 | } 36 | 37 | // store sourref 38 | $sour = $asso->getSour(); 39 | if ($sour && count($sour) > 0) { 40 | foreach ($sour as $item) { 41 | if ($item) { 42 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\SourRef::read($conn, $item, $_group, $_gid); 43 | } 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Utils/Importer/Indi/Desi.php: -------------------------------------------------------------------------------- 1 | $group, 'gid'=>$group_id, 'desi'=>$desi]; 20 | $data = ['group'=>$group, 'gid'=>$group_id, 'desi'=>$desi]; 21 | $record = PersonDesi::on($conn)->updateOrCreate($key, $data); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Utils/Importer/Indi/Even.php: -------------------------------------------------------------------------------- 1 | id; 20 | $type = $even->getType(); 21 | $attr = $even->getAttr(); 22 | $_date = $even->getDate(); 23 | $date = \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Date::read($conn, $_date); 24 | $_plac = $even->getPlac(); 25 | $plac = \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Indi\Even\Plac::read($conn, $_plac); 26 | 27 | $_phon = $even->getPhon(); 28 | $phon = \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Phon::read($conn, $_phon); 29 | $_addr = $even->getAddr(); 30 | $addr_id = \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Addr::read($conn, $_addr); 31 | 32 | $caus = $even->getCaus(); 33 | $age = $even->getAge(); 34 | $agnc = $even->getAgnc(); 35 | $adop = ''; 36 | $adop_famc = ''; 37 | $birt_famc = ''; 38 | switch ($class_name) { 39 | case 'Adop': 40 | $adop = $even->getAdop(); 41 | $adop_famc = $even->getFamc(); 42 | break; 43 | case 'Birt': 44 | $birt_famc = $even->getFamc(); 45 | break; 46 | case 'Bapm': 47 | break; 48 | case 'Barm': 49 | break; 50 | case 'Basm': 51 | break; 52 | case 'Bles': 53 | break; 54 | case 'Buri': 55 | break; 56 | case 'Cast': 57 | break; 58 | case 'Cens': 59 | break; 60 | case 'Chr': 61 | $chr_famc = $even->getFamc(); 62 | break; 63 | case 'Chra': 64 | break; 65 | case 'Conf': 66 | break; 67 | case 'Crem': 68 | break; 69 | case 'Dscr': 70 | break; 71 | case 'Deat': 72 | break; 73 | case 'Educ': 74 | break; 75 | case 'Emig': 76 | break; 77 | case 'Fcom': 78 | break; 79 | case 'Grad': 80 | break; 81 | case 'Idno': 82 | break; 83 | case 'Immi': 84 | break; 85 | case 'Nati': 86 | break; 87 | case 'Nchi': 88 | break; 89 | case 'Natu': 90 | break; 91 | case 'Nmr': 92 | break; 93 | case 'Occu': 94 | break; 95 | case 'Ordn': 96 | break; 97 | case 'Reti': 98 | break; 99 | case 'Prob': 100 | break; 101 | case 'Prop': 102 | break; 103 | case 'Reli': 104 | break; 105 | case 'Resi': 106 | break; 107 | case 'Ssn': 108 | break; 109 | case 'Titl': 110 | break; 111 | case 'Will': 112 | break; 113 | case 'Even': 114 | break; 115 | default: 116 | } 117 | $adop = ''; 118 | $adop_famc = ''; 119 | $birt_famc = ''; 120 | // store Even 121 | $key = [ 122 | 'person_id' => $person_id, 123 | 'title' => $class_name, 124 | 'type' => $type, 125 | 'attr' => $attr, 126 | 'date' => $date, 127 | 'plac' => $plac, 128 | 'phon' => $phon, 129 | 'caus' => $caus, 130 | 'age' => $age, 131 | 'agnc' => $agnc, 132 | 'adop' => $adop, 133 | 'adop_famc' => $adop_famc, 134 | 'birt_famc' => $birt_famc, 135 | ]; 136 | $data = [ 137 | 'person_id' => $person_id, 138 | 'title' => $class_name, 139 | 'type' => $type, // 140 | 'attr' => $attr, // 141 | 'date' => $date, 142 | 'plac' => $plac, // 143 | 'addr_id' => $addr_id, // 144 | 'phon' => $phon, // 145 | 'caus' => $caus, // 146 | 'age' => $age, // 147 | 'agnc' => $agnc, // 148 | 'adop' => $adop, // 149 | 'adop_famc' => $adop_famc, // 150 | 'birt_famc' => $birt_famc, // 151 | ]; 152 | $record = PersonEvent::on($conn)->updateOrCreate($key, $data); 153 | 154 | $_group = 'indi_even'; 155 | $_gid = $record->id; 156 | 157 | // update person's record 158 | if ($class_name == 'BIRT' && !empty($date)) { 159 | $person->birthday = date('Y-m-d', strtotime($date)); 160 | } 161 | // add deathyear to person table ( for form builder ) 162 | if ($class_name == 'DEAT' && !empty($date)) { 163 | $person->deathday = date('Y-m-d', strtotime($date)); 164 | } 165 | $person->save(); 166 | 167 | // array 168 | $sour = $even->getSour(); 169 | if ($sour && count($sour) > 0) { 170 | foreach ($sour as $item) { 171 | if ($item) { 172 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\SourRef::read($conn, $item, $_group, $_gid); 173 | } 174 | } 175 | } 176 | $obje = $even->getObje(); 177 | if ($obje && count($obje) > 0) { 178 | foreach ($obje as $item) { 179 | if ($item) { 180 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\ObjeRef::read($conn, $item, $_group, $_gid, $obje_ids); 181 | } 182 | } 183 | } 184 | $notes = $even->getNote(); 185 | if ($notes && count($notes) > 0) { 186 | foreach ($notes as $item) { 187 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\NoteRef::read($conn, $item, $_group, $_gid); 188 | } 189 | } 190 | // object 191 | $_chan = $even->getChan() ?? null; 192 | if ($_chan !== null) { 193 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Chan::read($conn, $_chan, $_group, $_gid); 194 | } 195 | 196 | // $_type = $even->getType(); 197 | // $person->addEvent($_type, $date, $plac); 198 | } 199 | } 200 | -------------------------------------------------------------------------------- /src/Utils/Importer/Indi/Even/Plac.php: -------------------------------------------------------------------------------- 1 | getPlac(); 18 | } 19 | 20 | return $place; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Utils/Importer/Indi/Lds.php: -------------------------------------------------------------------------------- 1 | getStat(); 19 | $date = $lds->getDate(); 20 | $plac = $lds->getPlac(); 21 | $temp = $lds->getTemp(); 22 | 23 | $slgc_famc = ''; 24 | if ($type == 'SLGC') { 25 | $slgc_famc = $lds->getFamc(); 26 | } 27 | // store refn 28 | $key = [ 29 | 'group' => $group, 30 | 'gid' => $group_id, 31 | 'type' => $type, 32 | 'stat' => $stat, 33 | 'date' => $date, 34 | 'plac' => $plac, 35 | 'temp' => $temp, 36 | 'slgc_famc' => $slgc_famc, 37 | ]; 38 | $data = [ 39 | 'group' => $group, 40 | 'gid' => $group_id, 41 | 'type' => $type, 42 | 'stat' => $stat, 43 | 'date' => $date, 44 | 'plac' => $plac, 45 | 'temp' => $temp, 46 | 'slgc_famc' => $slgc_famc, 47 | ]; 48 | $record = PersonLds::on($conn)->updateOrCreate($key, $data); 49 | 50 | $_group = 'indi_lds'; 51 | $_gid = $record->id; 52 | // add sour 53 | $sour = $lds->getSour(); 54 | if ($sour && count($sour) > 0) { 55 | foreach ($sour as $item) { 56 | if ($item) { 57 | SourRef::read($conn, $item, $_group, $_gid, $sour_ids, $obje_ids); 58 | } 59 | } 60 | } 61 | 62 | // add note 63 | $note = $lds->getNote(); 64 | if ($note && count($note) > 0) { 65 | foreach ($note as $item) { 66 | if ($item) { 67 | NoteRef::read($conn, $item, $_group, $_gid); 68 | } 69 | } 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/Utils/Importer/Indi/Name.php: -------------------------------------------------------------------------------- 1 | getName(); 17 | $type = $item->getType(); 18 | $npfx = $item->getNpfx(); 19 | $givn = $item->getGivn(); 20 | $nick = $item->getNick(); 21 | $spfx = $item->getSpfx(); 22 | $surn = $item->getSurn(); 23 | $nsfx = $item->getNsfx(); 24 | 25 | // store asso 26 | $key = [ 27 | 'group'=> $group, 28 | 'gid' => $group_id, 29 | 'type' => $type, 30 | 'name' => $name, 31 | 'npfx' => $npfx, 32 | 'givn' => $givn, 33 | 'nick' => $nick, 34 | 'spfx' => $spfx, 35 | 'surn' => $surn, 36 | 'nsfx' => $nsfx, 37 | ]; 38 | $data = [ 39 | 'group'=> $group, 40 | 'gid' => $group_id, 41 | 'type' => $type, 42 | 'name' => $name, 43 | 'npfx' => $npfx, 44 | 'givn' => $givn, 45 | 'nick' => $nick, 46 | 'spfx' => $spfx, 47 | 'surn' => $surn, 48 | 'nsfx' => $nsfx, 49 | ]; 50 | 51 | $record = PersonName::on($conn)->updateOrCreate($key, $data); 52 | 53 | $_group = 'indi_name'; 54 | $_gid = $record->id; 55 | // store Note 56 | $note = $item->getNote(); 57 | if ($note && count($note) > 0) { 58 | foreach ($note as $_item) { 59 | if ($_item) { 60 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\NoteRef::read($conn, $_item, $_group, $_gid); 61 | } 62 | } 63 | } 64 | 65 | // store sourref 66 | $sour = $item->getSour(); 67 | if ($sour && count($sour) > 0) { 68 | foreach ($sour as $_item) { 69 | if ($_item) { 70 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\SourRef::read($conn, $_item, $_group, $_gid); 71 | } 72 | } 73 | } 74 | 75 | // store fone 76 | $fone = $item->getFone(); 77 | if ($fone != null) { 78 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Indi\Name\Fone::read($conn, $fone, $_group, $_gid); 79 | } 80 | 81 | // store romn 82 | $romn = $item->getRomn(); 83 | if ($romn != null) { 84 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Indi\Name\Romn::read($conn, $romn, $_group, $_gid); 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/Utils/Importer/Indi/Name/Fone.php: -------------------------------------------------------------------------------- 1 | getType(); 17 | $name = $item->getName(); 18 | $npfx = $item->getNpfx(); 19 | $givn = $item->getGivn(); 20 | $nick = $item->getNick(); 21 | $spfx = $item->getSpfx(); 22 | $surn = $item->getSurn(); 23 | $nsfx = $item->getNsfx(); 24 | 25 | // store asso 26 | $key = [ 27 | 'group'=> $group, 28 | 'gid' => $group_id, 29 | 'type' => $type, 30 | 'name' => $name, 31 | 'npfx' => $npfx, 32 | 'givn' => $givn, 33 | 'nick' => $nick, 34 | 'spfx' => $spfx, 35 | 'surn' => $surn, 36 | 'nsfx' => $nsfx, 37 | ]; 38 | $data = [ 39 | 'group'=> $group, 40 | 'gid' => $group_id, 41 | 'type' => $type, 42 | 'name' => $name, 43 | 'npfx' => $npfx, 44 | 'givn' => $givn, 45 | 'nick' => $nick, 46 | 'spfx' => $spfx, 47 | 'surn' => $surn, 48 | 'nsfx' => $nsfx, 49 | ]; 50 | 51 | $record = PersonNameFone::on($conn)->updateOrCreate($key, $data); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/Utils/Importer/Indi/Name/Romn.php: -------------------------------------------------------------------------------- 1 | getType(); 17 | $npfx = $item->getNpfx(); 18 | $givn = $item->getGivn(); 19 | $nick = $item->getNick(); 20 | $spfx = $item->getSpfx(); 21 | $surn = $item->getSurn(); 22 | $nsfx = $item->getNsfx(); 23 | 24 | // store asso 25 | $key = [ 26 | 'group'=> $group, 27 | 'gid' => $group_id, 28 | 'type' => $type, 29 | 'npfx' => $npfx, 30 | 'givn' => $givn, 31 | 'nick' => $nick, 32 | 'spfx' => $spfx, 33 | 'surn' => $surn, 34 | 'nsfx' => $nsfx, 35 | ]; 36 | $data = [ 37 | 'group'=> $group, 38 | 'gid' => $group_id, 39 | 'type' => $type, 40 | 'npfx' => $npfx, 41 | 'givn' => $givn, 42 | 'nick' => $nick, 43 | 'spfx' => $spfx, 44 | 'surn' => $surn, 45 | 'nsfx' => $nsfx, 46 | ]; 47 | 48 | $record = PersonNameRomn::on($conn)->updateOrCreate($key, $data); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Utils/Importer/Indi/Subm.php: -------------------------------------------------------------------------------- 1 | $group, 'gid'=>$group_id, 'subm'=>$subm_id]; 20 | $data = ['group'=>$group, 'gid'=>$group_id, 'subm'=>$subm_id]; 21 | $record = PersonSubm::on($conn)->updateOrCreate($key, $data); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Utils/Importer/Note.php: -------------------------------------------------------------------------------- 1 | getNote(); 17 | $rin = $note->getRin(); 18 | 19 | // store note 20 | $key = ['group'=>$group, 'gid'=>$group_id, 'note'=>$_note]; 21 | $data = ['group'=>$group, 'gid'=>$group_id, 'note'=>$_note, 'rin'=>$rin]; 22 | $record = MNote::on($conn)->updateOrCreate($key, $data); 23 | 24 | // store Sources of Note 25 | $_group = 'note'; 26 | $_gid = $record->id; 27 | // SourRef array 28 | $sour = $note->getSour(); 29 | if ($sour && count($sour) > 0) { 30 | foreach ($sour as $item) { 31 | SourRef::read($conn, $item, $_group, $_gid); 32 | } 33 | } 34 | // Refn array 35 | $refn = $note->getRefn(); 36 | if ($refn && count($refn) > 0) { 37 | foreach ($refn as $item) { 38 | Refn::read($conn, $item, $_group, $_gid); 39 | } 40 | } 41 | 42 | // Chan 43 | $chan = $note->getChan(); 44 | if ($chan !== null) { 45 | Chan::read($conn, $chan, $_group, $_gid); 46 | } 47 | 48 | return $_gid; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Utils/Importer/NoteRef.php: -------------------------------------------------------------------------------- 1 | getNote(); 17 | 18 | // store note 19 | $key = ['group'=>$group, 'gid'=>$group_id, 'note'=>$note]; 20 | $data = ['group'=>$group, 'gid'=>$group_id, 'note'=>$note]; 21 | $record = Note::on($conn)->updateOrCreate($key, $data); 22 | 23 | // store Sources of Note 24 | $_group = 'note'; 25 | $_gid = $record->id; 26 | // SourRef array 27 | $sour = $noteref->getSour(); 28 | if ($sour && count($sour) > 0) { 29 | foreach ($sour as $item) { 30 | SourRef::read($conn, $item, $_group, $_gid); 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Utils/Importer/Obje.php: -------------------------------------------------------------------------------- 1 | getId(); 21 | $rin = $obje->getRin(); // string 22 | 23 | // store Object 24 | $key = [ 25 | 'group' => $group, 26 | 'gid' => $group_id, 27 | 'rin' => $rin, 28 | 'obje_id' => $id, 29 | ]; 30 | $data = [ 31 | 'group' => $group, 32 | 'gid' => $group_id, 33 | 'rin' => $rin, 34 | 'obje_id' => $id, 35 | ]; 36 | 37 | $record = MediaObject::on($conn)->updateOrCreate($key, $data); 38 | 39 | $_group = 'obje'; 40 | $_gid = $record->id; 41 | 42 | $refn = $obje->getRefn(); // Record/Refn array 43 | if ($refn && count($refn) > 0) { 44 | foreach ($refn as $item) { 45 | Refn::read($conn, $item, $_group, $_gid); 46 | } 47 | } 48 | 49 | // store Note 50 | $note = $obje->getNote(); // Record/NoteRef array 51 | if ($note && count($note) > 0) { 52 | foreach ($note as $item) { 53 | NoteRef::read($conn, $item, $_group, $_gid); 54 | } 55 | } 56 | 57 | // store Note 58 | $files = $obje->getFile(); // Record/NoteRef array 59 | if (($files && count((is_countable($files) ? $files : [])))) { 60 | foreach ($files as $item) { 61 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\ObjeRef\File::read($conn, $item, $_group, $_gid); 62 | } 63 | } 64 | 65 | $chan = $obje->getChan(); // Recore/Chan 66 | if ($chan !== null) { 67 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Chan::read($conn, $chan, $_group, $_gid); 68 | } 69 | 70 | return $_gid; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/Utils/Importer/ObjeRef.php: -------------------------------------------------------------------------------- 1 | getObje(); 21 | if (isset($obje_ids[$obje_id])) { 22 | $obje_id = $obje_ids[$obje_id]; 23 | } 24 | $titl = $objeref->getTitl(); 25 | $file = $objeref->getFile(); 26 | 27 | // store MediaObject 28 | $key = ['group'=>$group, 'gid'=>$group_id, 'titl'=>$titl]; 29 | $data = [ 30 | 'group' => $group, 31 | 'gid' => $group_id, 32 | 'obje_id'=> $obje_id, 33 | 'titl' => $titl, 34 | ]; 35 | $record = MediaObject::on($conn)->updateOrCreate($key, $data); 36 | 37 | $_group = 'objeref'; 38 | $_gid = $record->id; 39 | // store Note 40 | 41 | $files = $objeref->getFile(); 42 | if ($files && count((is_countable($files) ? $files : []))) { 43 | foreach ($files as $item) { 44 | File::read($conn, $item, $_group, $_gid); 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Utils/Importer/ObjeRef/File.php: -------------------------------------------------------------------------------- 1 | getForm(); 17 | $medi = null; 18 | $type = null; 19 | if ($form) { 20 | $medi = $form->getMedi(); 21 | } 22 | 23 | // store File 24 | $key = ['group'=>$group, 'gid'=>$group_id, 'form'=>$form, 'medi'=>$medi, 'type'=> $type]; 25 | $data = ['group'=>$group, 'gid'=>$group_id, 'form'=>$form, 'medi'=>$medi, 'type'=>$type]; 26 | $record = MediaObjeectFile::on($conn)->updateOrCreate($key, $data); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Utils/Importer/Phon.php: -------------------------------------------------------------------------------- 1 | getPhon(); 19 | } 20 | } else { 21 | if (is_array($phon)) { 22 | $ret = ''; 23 | $ret = json_encode($phon); 24 | 25 | return $ret; 26 | } else { 27 | return "$phon"; 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Utils/Importer/Refn.php: -------------------------------------------------------------------------------- 1 | getRefn(); 17 | $type = $refn->getType(); 18 | // store refn 19 | $key = ['group'=>$group, 'gid'=>$group_id, 'refn'=>$_refn, 'type'=>$type]; 20 | $data = ['group'=>$group, 'gid'=>$group_id, 'refn'=>$_refn, 'type'=>$type]; 21 | $record = MRefn::on($conn)->updateOrCreate($key, $data); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Utils/Importer/Repo.php: -------------------------------------------------------------------------------- 1 | getName(); // string 20 | $rin = $repo->getRin(); // string 21 | $addr = $repo->getAddr(); // Record/Addr 22 | $addr_id = \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Addr::read($conn, $addr); 23 | $_phon = $repo->getPhon(); // Record/Phon array 24 | $phon = implode(',', $_phon); 25 | $_email = $repo->getEmail(); 26 | $email = implode(',', $_email); 27 | $_fax = $repo->getFax(); 28 | $fax = implode(',', $_fax); 29 | $_www = $repo->getWww(); 30 | $www = implode(',', $_www); 31 | // store Source 32 | $key = [ 33 | 'group' => $group, 34 | 'gid' => $group_id, 35 | 'name' => $name, 36 | 'rin' => $rin, 37 | 'addr_id' => $addr_id, 38 | 'phon' => $phon, 39 | 'email' => $email, 40 | 'fax' => $fax, 41 | 'www' => $www, 42 | ]; 43 | $data = [ 44 | 'group' => $group, 45 | 'gid' => $group_id, 46 | 'name' => $name, 47 | 'rin' => $rin, 48 | 'addr_id' => $addr_id, 49 | 'phon' => $phon, 50 | 'email' => $email, 51 | 'fax' => $fax, 52 | 'www' => $www, 53 | ]; 54 | 55 | $record = Repository::on($conn)->updateOrCreate($key, $data); 56 | 57 | $_group = 'repo'; 58 | $_gid = $record->id; 59 | // store Note 60 | $note = $repo->getNote(); // Record/NoteRef array 61 | if ($note && count($note) > 0) { 62 | foreach ($note as $item) { 63 | NoteRef::read($conn, $item, $_group, $_gid); 64 | } 65 | } 66 | $refn = $repo->getRefn(); // Record/Refn array 67 | if ($refn && count($refn) > 0) { 68 | foreach ($refn as $item) { 69 | Refn::read($conn, $item, $_group, $_gid); 70 | } 71 | } 72 | 73 | $chan = $repo->getChan(); // Recore/Chan 74 | if ($chan !== null) { 75 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Chan::read($conn, $chan, $_group, $_gid); 76 | } 77 | 78 | return $_gid; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/Utils/Importer/RepoRef.php: -------------------------------------------------------------------------------- 1 | getRepo(); 20 | // store Source 21 | $key = ['group'=>$group, 'gid'=>$group_id, 'repo' => $repo]; 22 | $data = [ 23 | 'group'=> $group, 24 | 'gid' => $group_id, 25 | 'repo' => $repo, 26 | ]; 27 | $record = Repository::on($conn)->updateOrCreate($key, $data); 28 | 29 | $_group = 'reporef'; 30 | $_gid = $record->id; 31 | // store Note 32 | $notes = $reporef->getNote(); 33 | if ($notes && count($notes) > 0) { 34 | foreach ($notes as $item) { 35 | NoteRef::read($conn, $item, $_group, $_gid); 36 | } 37 | } 38 | 39 | // store Caln 40 | $caln = $reporef->getCaln(); 41 | if ($caln && count($caln) > 0) { 42 | foreach ($caln as $item) { 43 | if ($item) { 44 | Caln::read($conn, $item, $_group, $_gid); 45 | } 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Utils/Importer/Sour.php: -------------------------------------------------------------------------------- 1 | getAuth(); // string 20 | $titl = $sour->getTitl(); // string 21 | $abbr = $sour->getAbbr(); // string 22 | $publ = $sour->getPubl(); // string 23 | $rin = $sour->getRin(); // string 24 | $text = $sour->getText(); // string 25 | 26 | $record = Source::on($conn)->updateOrCreate( 27 | compact('titl', 'rin', 'auth', 'text', 'publ', 'abbr'), 28 | compact('titl', 'rin', 'auth', 'text', 'publ', 'abbr') 29 | ); 30 | 31 | $_group = 'sour'; 32 | $_gid = $record->id; 33 | 34 | $chan = $sour->getChan(); // Record/Chan 35 | if ($chan !== null) { 36 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Chan::read($conn, $chan, $_group, $_gid = 0); 37 | } 38 | $repo = $sour->getRepo(); // Repo 39 | if ($repo !== null) { 40 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Sour\Repo::read($conn, $repo, $_group, $_gid = 0); 41 | } 42 | $data = $sour->getData(); // object 43 | if ($data !== null) { 44 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Sour\Data::read($conn, $data, $_group, $_gid = 0); 45 | } 46 | $refn = $sour->getRefn(); // array 47 | if ($refn && count($refn) > 0) { 48 | foreach ($refn as $item) { 49 | if ($item) { 50 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Refn::read($conn, $item, $_group, $_gid = 0); 51 | } 52 | } 53 | } 54 | 55 | $note = $sour->getNote(); // array 56 | if ($note != null && count($note) > 0) { 57 | foreach ($note as $item) { 58 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\NoteRef::read($conn, $item, $_group, $_gid); 59 | } 60 | } 61 | 62 | $obje = $sour->getObje(); // array 63 | if ($obje && count($obje) > 0) { 64 | foreach ($obje as $item) { 65 | if ($item) { 66 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\ObjeRef::read($conn, $item, $_group, $_gid, $obje_ids); 67 | } 68 | } 69 | } 70 | 71 | $sour = $sour->getSour(); // string id 72 | 73 | return $_gid; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/Utils/Importer/Sour/Data.php: -------------------------------------------------------------------------------- 1 | getDate(); 19 | $agnc = $data->getAgnc(); 20 | $text = $data->getText(); 21 | 22 | // store Data of sources 23 | $key = ['group'=>$group, 'gid'=>$group_id, 'date'=>$date, 'text'=>$text, 'agnc'=>$agnc]; 24 | $_data = ['group'=>$group, 'gid'=>$group_id, 'date'=>$date, 'text'=>$text, 'agnc'=>$agnc]; 25 | $record = SourceData::on($conn)->updateOrCreate($key, $_data); 26 | 27 | $_group = 'sourcedata'; 28 | $_gid = $record->id; 29 | // \PhpGedcom\Record\Sour\Data\Even array 30 | $even = $data->getEven(); 31 | if ($even && count($even) > 0) { 32 | foreach ($even as $item) { 33 | Even::read($conn, $item, $_group, $_gid); 34 | } 35 | } 36 | // \PhpGedcom\Record\NoteRef array 37 | $note = $data->getNote(); 38 | if ($note && count($note) > 0) { 39 | foreach ($note as $item) { 40 | NoteRef::read($conn, $item, $_group, $_gid); 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Utils/Importer/Sour/Data/Even.php: -------------------------------------------------------------------------------- 1 | getDate(); 17 | $plac = $even->getPlac(); 18 | 19 | // store Even of source/data 20 | $key = ['group'=>$group, 'gid'=>$group_id, 'date'=>$date, 'plac'=>$plac]; 21 | $data = ['group'=>$group, 'gid'=>$group_id, 'date'=>$date, 'plac'=>$plac]; 22 | $record = SourceDataEven::on($conn)->updateOrCreate($key, $data); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Utils/Importer/Sour/Repo.php: -------------------------------------------------------------------------------- 1 | getRepo(); 18 | if (empty($repo_id)) { 19 | $repo_id = rand(1, 10000); 20 | } 21 | $_caln = $data->getCaln(); 22 | $caln = ''; 23 | if ($_caln != null && count($_caln) > 0) { 24 | $temp = []; 25 | foreach ($_caln as $item) { 26 | $__caln = $item->getCaln(); 27 | $__medi = $item->getMedi(); 28 | $temp_item = $__caln.':'.$__medi; 29 | $temp[] = $temp_item; 30 | } 31 | $caln = implode(',', $temp); 32 | unset($temp); 33 | // example 34 | // +1 1123 123123:avi,+1 123 123 123:mpg 35 | } 36 | // store Data of sources 37 | $key = ['group'=>$group, 'gid'=>$group_id, 'repo_id'=>$repo_id]; 38 | $_data = ['group'=>$group, 'gid'=>$group_id, 'repo_id'=>$repo_id, 'caln'=>$caln]; 39 | $record = SourceRepo::on($conn)->updateOrCreate($key, $_data); 40 | 41 | $_group = 'sourcerepo'; 42 | $_gid = $record->id; 43 | 44 | // \PhpGedcom\Record\NoteRef array 45 | $note = $data->getNote(); 46 | if ($note && count($note) > 0) { 47 | foreach ($note as $item) { 48 | NoteRef::read($conn, $item, $_group, $_gid); 49 | } 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/Utils/Importer/SourRef.php: -------------------------------------------------------------------------------- 1 | getSour(); 23 | if (!isset($sour_ids[$sour])) { 24 | return; 25 | } 26 | $sour_id = $sour_ids[$sour]; 27 | $text = $sourref->getText(); 28 | $quay = $sourref->getQuay(); 29 | $page = $sourref->getPage(); 30 | 31 | // store Source 32 | $key = ['group'=>$group, 'gid'=>$group_id, 'sour_id'=>$sour_id]; 33 | $data = [ 34 | 'group' => $group, 35 | 'gid' => $group_id, 36 | 'sour_id'=> $sour_id, 37 | 'text' => $text, 38 | 'quay' => $quay, 39 | 'page' => $page, 40 | ]; 41 | $record = SourceRef::on($conn)->updateOrCreate($key, $data); 42 | 43 | $_group = 'sourref'; 44 | $_gid = $record->id; 45 | // store MediaObje 46 | $objes = $sourref->getObje(); 47 | if ($objes && count($objes) > 0) { 48 | foreach ($objes as $item) { 49 | ObjeRef::read($conn, $item, $_group, $_gid, $obje_ids); 50 | } 51 | } 52 | 53 | // store Note 54 | $notes = $sourref->getNote(); 55 | if ($notes && count($notes) > 0) { 56 | foreach ($notes as $item) { 57 | NoteRef::read($conn, $item, $_group, $_gid); 58 | } 59 | } 60 | 61 | // store Data 62 | $data = $sourref->getData(); 63 | if ($data) { 64 | Data::read($conn, $data, $_group, $_gid); 65 | } 66 | 67 | // store \PhpGedcom\Record\SourRef\Even 68 | $even = $sourref->getEven(); 69 | if ($even) { 70 | Even::read($conn, $even, $_group, $_gid); 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/Utils/Importer/SourRef/Even.php: -------------------------------------------------------------------------------- 1 | getEven(); 17 | $role = $even->getRole(); 18 | 19 | // store Even of source/data 20 | $key = ['group'=>$group, 'gid'=>$group_id, 'even'=>$_even, 'role'=>$role]; 21 | $data = ['group'=>$group, 'gid'=>$group_id, 'even'=>$_even, 'role'=>$role]; 22 | $record = SourceRefEven::on($conn)->updateOrCreate($key, $data); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Utils/Importer/Subm.php: -------------------------------------------------------------------------------- 1 | getName() ?? null; // string 21 | if (!is_object($subm)) { 22 | $name = $subm; 23 | } 24 | $addr = $subm->getAddr() ?? null; 25 | $addr_id = \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Addr::read($conn, $addr); 26 | $_phon = $subm->getPhon() ?? []; // array 27 | $phon = implode(',', $_phon); 28 | $_email = $subm->getEmail() ?? []; 29 | $email = implode(',', $_email); 30 | $_fax = $subm->getFax() ?? []; 31 | $fax = implode(',', $_fax); 32 | $_www = $subm->getWww() ?? []; 33 | $www = implode(',', $_www); 34 | 35 | $rin = $subm->getRin() ?? null; // string 36 | $rfn = $subm->getRfn() ?? null; // string 37 | 38 | $_lang = $subm->getLang(); // string array 39 | $lang = implode(',', $_lang); 40 | $key = [ 41 | 'group' => $group, 42 | 'gid' => $gid, 43 | 'name' => $name, 44 | 'addr_id' => $addr_id, 45 | 'lang' => $lang, 46 | 'phon' => $phon, 47 | 'email' => $email, 48 | 'fax' => $fax, 49 | 'www' => $www, 50 | 'rin' => $rin, 51 | 'rfn' => $rfn, 52 | ]; 53 | $data = [ 54 | 'group' => $group, 55 | 'gid' => $gid, 56 | 'name' => $name, 57 | 'addr_id' => $addr_id, 58 | 'lang' => $lang, 59 | 'phon' => $phon, 60 | 'email' => $email, 61 | 'fax' => $fax, 62 | 'www' => $www, 63 | 'rin' => $rin, 64 | 'rfn' => $rfn, 65 | ]; 66 | $record = MSubm::on($conn)->updateOrCreate($key, $data); 67 | $_group = 'subm'; 68 | $_gid = $record->id; 69 | 70 | $note = $subm->getNote(); // array --- 71 | 72 | if ($note != null && count($note) > 0) { 73 | foreach ($note as $item) { 74 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\NoteRef::read($conn, $item, $_group, $_gid); 75 | } 76 | } 77 | $obje = $subm->getObje() ?? null; // array --- 78 | if ($obje && count($obje) > 0) { 79 | foreach ($obje as $item) { 80 | if ($item) { 81 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\ObjeRef::read($conn, $item, $_group, $_gid, $obje_ids); 82 | } 83 | } 84 | } 85 | $chan = $subm->getChan() ?? null; // Record\Chan--- 86 | if ($chan !== null) { 87 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Chan::read($conn, $chan, $_group, $_gid); 88 | } 89 | 90 | return $_gid; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /src/Utils/Importer/Subn.php: -------------------------------------------------------------------------------- 1 | getSubm(); 20 | $subm = null; 21 | if (isset($subm_ids[$subm])) { 22 | $subm = $subm_ids[$_subm]; 23 | } 24 | $famf = $subn->getFamf(); 25 | $temp = $subn->getTemp(); 26 | $ance = $subn->getAnce(); 27 | $desc = $subn->getDesc(); 28 | $ordi = $subn->getOrdi(); 29 | $rin = $subn->getRin(); 30 | $record = MSubn::on($conn)->updateOrCreate(compact('subm', 'famf', 'temp', 'ance', 'desc', 'ordi', 'rin'), compact('subm', 'famf', 'temp', 'ance', 'desc', 'ordi', 'rin')); 31 | 32 | $_group = 'subn'; 33 | $_gid = $record->id; 34 | 35 | $note = $subn->getNote(); // array --- 36 | 37 | if ($note != null && count($note) > 0) { 38 | foreach ($note as $item) { 39 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\NoteRef::read($conn, $item, $_group, $_gid); 40 | } 41 | } 42 | $chan = $subn->getChan() ?? null; // Record\Chan--- 43 | if ($chan !== null) { 44 | \GenealogiaWebsite\LaravelGedcom\Utils\Importer\Chan::read($conn, $chan, $_group, $_gid); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/migrations/2020_01_01_120000_create_default_people_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 14 | 15 | $table->tinyInteger('title')->nullable(); 16 | $table->string('name')->index(); 17 | $table->string('appellative')->index()->nullable(); 18 | 19 | $table->string('uid')->nullable()->unique(); 20 | $table->string('email')->unique()->nullable(); 21 | $table->string('phone')->nullable(); 22 | $table->date('birthday')->nullable(); 23 | 24 | $table->string('bank')->nullable(); 25 | $table->string('bank_account')->nullable(); 26 | 27 | $table->text('obs')->nullable(); 28 | 29 | $table->integer('created_by')->unsigned()->index()->nullable(); 30 | 31 | $table->integer('updated_by')->unsigned()->index()->nullable(); 32 | 33 | $table->timestamps(); 34 | }); 35 | } 36 | } 37 | 38 | public function down() 39 | { 40 | Schema::dropIfExists('people'); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/migrations/2020_04_10_154637_create_citations_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('name'); 19 | $table->text('description', 65535); 20 | $table->dateTime('date')->nullable(); 21 | $table->integer('is_active'); 22 | $table->integer('volume'); 23 | $table->integer('page'); 24 | $table->integer('confidence'); 25 | $table->integer('source_id')->references('id')->on('sources'); 26 | $table->timestamps(); 27 | }); 28 | } 29 | 30 | /** 31 | * Reverse the migrations. 32 | * 33 | * @return void 34 | */ 35 | public function down() 36 | { 37 | Schema::dropIfExists('citations'); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/migrations/2020_04_10_154850_create_families_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->text('description')->nullable(); 19 | $table->integer('is_active'); 20 | $table->integer('type_id'); 21 | $table->integer('husband_id')->references('id')->on('persons')->nullable(); 22 | $table->integer('wife_id')->references('id')->on('persons')->nullable(); 23 | $table->timestamps(); 24 | $table->softDeletes(); 25 | }); 26 | } 27 | 28 | /** 29 | * Reverse the migrations. 30 | * 31 | * @return void 32 | */ 33 | public function down() 34 | { 35 | Schema::dropIfExists('families'); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/migrations/2020_04_10_155019_create_notes_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('name')->nullable(); 19 | $table->text('description', 65535)->nullable(); 20 | $table->dateTime('date')->nullable(); 21 | $table->integer('type_id')->nullable(); 22 | $table->integer('is_active')->nullable(); 23 | $table->string('group')->nullable(); 24 | $table->string('gid')->nullable(); 25 | $table->longText('note')->nullable(); 26 | $table->string('rin')->nullable(); 27 | $table->timestamps(); 28 | }); 29 | } 30 | 31 | /** 32 | * Reverse the migrations. 33 | * 34 | * @return void 35 | */ 36 | public function down() 37 | { 38 | Schema::dropIfExists('notes'); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/migrations/2020_04_10_155134_create_places_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('title'); 19 | $table->text('description', 65535); 20 | $table->dateTime('date')->nullable(); 21 | $table->timestamps(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::dropIfExists('places'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/migrations/2020_04_10_155307_create_repositories_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('group')->nullable(); 19 | $table->integer('gid')->nullable(); 20 | $table->string('name')->nullable(); 21 | $table->text('description', 65535)->nullable(); 22 | $table->dateTime('date')->nullable(); 23 | $table->integer('is_active')->nullable(); 24 | $table->integer('type_id')->nullable(); 25 | $table->string('repo')->nullable(); 26 | $table->integer('addr_id')->nullable(); 27 | $table->string('rin')->nullable(); 28 | $table->string('phon')->nullable(); 29 | $table->string('email')->nullable(); 30 | $table->string('fax')->nullable(); 31 | $table->string('www')->nullable(); 32 | $table->timestamps(); 33 | }); 34 | } 35 | 36 | /** 37 | * Reverse the migrations. 38 | * 39 | * @return void 40 | */ 41 | public function down() 42 | { 43 | Schema::dropIfExists('repositories'); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/migrations/2020_04_10_155413_create_sources_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('name')->nullable(); 19 | $table->text('description', 65535)->nullable(); 20 | $table->dateTime('date')->nullable(); 21 | $table->integer('is_active')->nullable(); 22 | $table->integer('author_id')->nullable(); 23 | $table->integer('repository_id')->references('id')->on('repositories')->nullable(); 24 | $table->integer('publication_id')->nullable(); 25 | $table->integer('type_id')->nullable(); 26 | $table->string('sour')->nullable(); 27 | $table->text('titl', 65535)->nullable(); 28 | $table->string('auth')->nullable(); 29 | $table->string('data')->nullable(); 30 | $table->text('text', 65535)->nullable(); 31 | $table->text('publ', 65535)->nullable(); 32 | $table->string('abbr')->nullable(); 33 | $table->string('group')->nullable(); 34 | $table->integer('gid')->nullable(); 35 | $table->string('quay')->nullable(); 36 | $table->text('page', 65535)->nullable(); 37 | $table->string('rin')->nullable(); 38 | $table->string('note')->nullable(); 39 | $table->timestamps(); 40 | }); 41 | } 42 | 43 | /** 44 | * Reverse the migrations. 45 | * 46 | * @return void 47 | */ 48 | public function down() 49 | { 50 | Schema::dropIfExists('sources'); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/migrations/2020_04_10_171030_create_types_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('name'); 19 | $table->string('description'); 20 | $table->integer('is_active'); 21 | $table->timestamps(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::dropIfExists('types'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/migrations/2020_04_24_211718_create_authors_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('name'); 19 | $table->string('description'); 20 | $table->integer('is_active'); 21 | $table->timestamps(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::dropIfExists('authors'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/migrations/2020_04_24_211852_create_publications_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('name'); 19 | $table->string('description'); 20 | $table->integer('is_active'); 21 | 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('publications'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/migrations/2020_06_01_112223_create_persons_events_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->timestamps(); 19 | $table->softDeletes(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::dropIfExists('person_events'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/migrations/2020_06_01_112242_create_family_events_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->integer('family_id')->references('id')->on('families'); 19 | $table->integer('places_id')->references('id')->on('places')->nullable(); 20 | $table->text('date')->nullable(); 21 | $table->string('title')->nullable(); 22 | $table->text('description')->nullable(); 23 | $table->timestamps(); 24 | $table->softDeletes(); 25 | }); 26 | } 27 | 28 | /** 29 | * Reverse the migrations. 30 | * 31 | * @return void 32 | */ 33 | public function down() 34 | { 35 | Schema::drop('family_events'); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/migrations/2020_06_01_112312_update_events_add_timestamp.php: -------------------------------------------------------------------------------- 1 | integer('year')->nullable(); 18 | $table->integer('month')->nullable(); 19 | $table->integer('day')->nullable(); 20 | $table->string('type')->nullable(); 21 | $table->string('attr')->nullable(); 22 | $table->string('plac')->nullable(); 23 | $table->integer('addr_id')->nullable(); 24 | $table->string('phon')->nullable(); 25 | $table->text('caus', 65535)->nullable(); 26 | $table->string('age')->nullable(); 27 | $table->string('agnc')->nullable(); 28 | $table->string('adop')->nullable(); 29 | $table->string('adop_famc')->nullable(); 30 | $table->string('birt_famc')->nullable(); 31 | }); 32 | Schema::table('family_events', function (Blueprint $table) { 33 | $table->integer('year')->nullable(); 34 | $table->integer('month')->nullable(); 35 | $table->integer('day')->nullable(); 36 | $table->string('type')->nullable(); 37 | $table->string('plac')->nullable(); 38 | $table->integer('addr_id')->nullable(); 39 | $table->string('phon')->nullable(); 40 | $table->text('caus', 65535)->nullable(); 41 | $table->string('age')->nullable(); 42 | $table->string('agnc')->nullable(); 43 | $table->integer('husb')->nullable(); 44 | $table->integer('wife')->nullable(); 45 | }); 46 | } 47 | 48 | /** 49 | * Reverse the migrations. 50 | * 51 | * @return void 52 | */ 53 | public function down() 54 | { 55 | Schema::table('person_events', function (Blueprint $table) { 56 | $table->dropColumn('year'); 57 | $table->dropColumn('month'); 58 | $table->dropColumn('day'); 59 | $table->dropColumn('type'); 60 | $table->dropColumn('attr'); 61 | $table->dropColumn('plac'); 62 | $table->dropColumn('addr_id'); 63 | $table->dropColumn('phon'); 64 | $table->dropColumn('caus'); 65 | $table->dropColumn('age'); 66 | $table->dropColumn('agnc'); 67 | $table->dropColumn('adop'); 68 | $table->dropColumn('adop_famc'); 69 | $table->dropColumn('birt_famc'); 70 | }); 71 | Schema::table('family_events', function (Blueprint $table) { 72 | $table->dropColumn('year'); 73 | $table->dropColumn('month'); 74 | $table->dropColumn('day'); 75 | $table->dropColumn('type'); 76 | $table->dropColumn('plac'); 77 | $table->dropColumn('addr_id'); 78 | $table->dropColumn('phon'); 79 | $table->dropColumn('caus'); 80 | $table->dropColumn('age'); 81 | $table->dropColumn('agnc'); 82 | $table->dropColumn('husb'); 83 | $table->dropColumn('wife'); 84 | }); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /src/migrations/2020_06_03_192100_add_columns_for_people_table.php: -------------------------------------------------------------------------------- 1 | string('gid')->nullable(); 13 | $table->string('givn')->nullable(); 14 | $table->string('surn', 255)->nullable(); 15 | $table->string('name', 255)->nullable()->change(); 16 | 17 | $table->string('type')->nullable(); 18 | $table->string('npfx')->nullable(); 19 | $table->string('nick')->nullable(); 20 | $table->string('spfx')->nullable(); 21 | $table->string('nsfx')->nullable(); 22 | 23 | $table->char('sex', 1)->nullable(); 24 | $table->text('description')->nullable(); 25 | $table->integer('child_in_family_id')->references('id')->on('families')->nullable(); 26 | $table->softDeletes(); 27 | $table->dropColumn('bank'); 28 | $table->dropColumn('bank_account'); 29 | }); 30 | } 31 | 32 | public function down() 33 | { 34 | Schema::table('people', function ($table) { 35 | $table->string('bank'); 36 | $table->string('bank_account'); 37 | $table->dropColumn('gid'); 38 | $table->dropColumn('givn'); 39 | $table->dropColumn('surn'); 40 | $table->string('name')->nullable(false)->change(); 41 | $table->dropColumn('sex'); 42 | $table->dropColumn('description'); 43 | $table->dropColumn('child_in_family_id'); 44 | $table->dropColumn('deleted_at'); 45 | }); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/migrations/2020_06_11_150000_update_add_columns_person_events_table.php: -------------------------------------------------------------------------------- 1 | unsignedBigInteger('person_id'); 19 | $table->string('title')->nullable(); 20 | $table->string('date')->nullable(); 21 | $table->string('description')->nullable(); 22 | $table->unsignedBigInteger('places_id')->nullable()->after('description'); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | // 34 | Schema::table('person_events', function (Blueprint $table) { 35 | $table->dropColumn('person_id'); 36 | $table->dropColumn('title'); 37 | $table->dropColumn('description'); 38 | $table->dropColumn('places_id'); 39 | $table->dropColumn('deleted_at'); 40 | }); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/migrations/2020_06_11_152802_update_description_default_places_table.php: -------------------------------------------------------------------------------- 1 | dropColumn('description'); 20 | }); 21 | } 22 | Schema::table('places', function (Blueprint $table) { 23 | $table->text('description', 65535)->nullable()->after('date'); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | // 35 | Schema::table('places', function (Blueprint $table) { 36 | $table->dropColumn('description'); 37 | }); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/migrations/2020_06_11_173643_update_add_columns_people_table.php: -------------------------------------------------------------------------------- 1 | string('chan')->nullable(); 19 | $table->string('rin')->nullable(); 20 | $table->string('resn')->nullable(); 21 | $table->string('rfn')->nullable(); 22 | $table->string('afn')->nullable(); 23 | $table->date('deathday')->nullable()->after('birthday'); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | // 35 | Schema::table('people', function (Blueprint $table) { 36 | $table->dropColumn('chan'); 37 | $table->dropColumn('rin'); 38 | $table->dropColumn('resn'); 39 | $table->dropColumn('rfn'); 40 | $table->dropColumn('afn'); 41 | $table->dropColumn('deathday'); 42 | }); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/migrations/2020_06_11_175726_update_add_columns_family_table.php: -------------------------------------------------------------------------------- 1 | string('chan')->nullable(); 19 | $table->string('nchi')->nullable(); 20 | $table->string('rin')->nullable(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | // 32 | Schema::table('families', function (Blueprint $table) { 33 | $table->dropColumn('chan'); 34 | $table->dropColumn('nchi'); 35 | $table->dropColumn('rin'); 36 | }); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/migrations/2020_06_12_173700_create_subns_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('subm')->nullable(); 19 | $table->string('famf')->nullable(); 20 | $table->string('temp')->nullable(); 21 | $table->string('ance')->nullable(); 22 | $table->string('desc')->nullable(); 23 | $table->string('ordi')->nullable(); 24 | $table->string('rin')->nullable(); 25 | 26 | $table->timestamps(); 27 | }); 28 | } 29 | 30 | /** 31 | * Reverse the migrations. 32 | * 33 | * @return void 34 | */ 35 | public function down() 36 | { 37 | Schema::dropIfExists('subns'); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/migrations/2020_06_12_190711_create_subm_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('group')->nullable(); 19 | $table->integer('gid')->nullable(); 20 | $table->string('name')->nullable(); 21 | $table->integer('addr_id')->nullable(); 22 | $table->string('rin')->nullable(); 23 | $table->string('rfn')->nullable(); 24 | $table->string('lang')->nullable(); 25 | $table->string('phon')->nullable(); 26 | $table->string('email')->nullable(); 27 | $table->string('fax')->nullable(); 28 | $table->string('www')->nullable(); 29 | $table->timestamps(); 30 | }); 31 | } 32 | 33 | /** 34 | * Reverse the migrations. 35 | * 36 | * @return void 37 | */ 38 | public function down() 39 | { 40 | Schema::dropIfExists('subms'); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/migrations/2020_06_13_003901_create_media_objects_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->integer('gid')->nullable(); 19 | $table->string('group')->nullable(); 20 | $table->string('titl')->nullable(); 21 | $table->string('obje_id')->nullable(); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('media_objects'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/migrations/2020_06_23_031852_create_importjobs_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->unsignedBigInteger('user_id')->nullable(); 19 | $table->string('slug')->nullable(); 20 | $table->string('status')->nullable(); 21 | $table->timestamps(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::dropIfExists('importjobs'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/migrations/2020_06_24_084354_create_sourcedata_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('group')->nullable(); 19 | $table->integer('gid')->nullable(); 20 | $table->string('date')->nullable(); 21 | $table->string('text')->nullable(); 22 | $table->string('agnc')->nullable(); 23 | $table->timestamps(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('source_data'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/migrations/2020_06_24_085159_create_source_data_even_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('group')->nullable(); 19 | $table->string('gid')->nullable(); 20 | $table->string('date')->nullable(); 21 | $table->string('plac')->nullable(); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('source_data_even'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/migrations/2020_06_24_090326_create_sourceref_even_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('group')->nullable(); 19 | $table->integer('gid')->nullable(); 20 | $table->string('even')->nullable(); 21 | $table->string('role')->nullable(); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('sourceref_even'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/migrations/2020_06_24_092055_create_person_alia_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('group')->nullable(); 19 | $table->integer('gid')->nullable(); 20 | $table->string('alia')->nullable(); 21 | $table->integer('import_confirm')->default(0); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('person_alia'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/migrations/2020_06_24_093608_create_person_asso_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('group')->nullable(); 19 | $table->integer('gid')->nullable(); 20 | $table->string('indi')->nullable(); 21 | $table->string('rela')->nullable(); 22 | $table->integer('import_confirm')->default(0); 23 | $table->timestamps(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('person_asso'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/migrations/2020_06_24_094758_create_person_subm_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('group')->nullable(); 19 | $table->integer('gid')->nullable(); 20 | $table->string('subm')->nullable(); 21 | $table->timestamps(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::dropIfExists('person_subm'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/migrations/2020_06_24_095241_create_person_anci_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('group')->nullable(); 19 | $table->integer('gid')->nullable(); 20 | $table->string('anci')->nullable(); 21 | $table->timestamps(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::dropIfExists('person_anci'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/migrations/2020_06_24_103355_create_refn_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('group')->nullable(); 19 | $table->integer('gid')->nullable(); 20 | $table->string('refn')->nullable(); 21 | $table->string('type')->nullable(); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('refn'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/migrations/2020_06_24_105140_create_person_lds_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('group')->nullable(); 19 | $table->integer('gid')->nullable(); 20 | $table->string('type')->nullable(); 21 | $table->string('stat')->nullable(); 22 | $table->string('date')->nullable(); 23 | $table->string('plac')->nullable(); 24 | $table->string('temp')->nullable(); 25 | $table->string('slac_famc')->nullable(); 26 | $table->timestamps(); 27 | }); 28 | } 29 | 30 | /** 31 | * Reverse the migrations. 32 | * 33 | * @return void 34 | */ 35 | public function down() 36 | { 37 | Schema::dropIfExists('person_lds'); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/migrations/2020_06_24_135407_create_chans_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('group')->nullable(); 19 | $table->integer('gid')->nullable(); 20 | $table->string('date')->nullable(); 21 | $table->string('time')->nullable(); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('chans'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/migrations/2020_06_25_040418_create_family_slgs_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->integer('family_id')->nullable(); 19 | $table->string('stat')->nullable(); 20 | $table->string('date')->nullable(); 21 | $table->string('plac')->nullable(); 22 | $table->string('temp')->nullable(); 23 | $table->timestamps(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('family_slgs'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/migrations/2020_06_25_052028_create_addrs_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('adr1')->nullable(); 19 | $table->string('adr2')->nullable(); 20 | $table->string('city')->nullable(); 21 | $table->string('stae')->nullable(); 22 | $table->string('post')->nullable(); 23 | $table->string('ctry')->nullable(); 24 | $table->timestamps(); 25 | }); 26 | } 27 | 28 | /** 29 | * Reverse the migrations. 30 | * 31 | * @return void 32 | */ 33 | public function down() 34 | { 35 | Schema::dropIfExists('addrs'); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/migrations/2020_08_21_100421_create_personname_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('group')->nullable(); 19 | $table->integer('gid')->nullable(); 20 | $table->string('name')->nullable(); 21 | $table->string('type')->nullable(); 22 | $table->string('npfx')->nullable(); 23 | $table->string('givn')->nullable(); 24 | $table->string('nick')->nullable(); 25 | $table->string('spfx')->nullable(); 26 | $table->string('surn')->nullable(); 27 | $table->string('nsfx')->nullable(); 28 | $table->timestamps(); 29 | }); 30 | } 31 | 32 | /** 33 | * Reverse the migrations. 34 | * 35 | * @return void 36 | */ 37 | public function down() 38 | { 39 | Schema::dropIfExists('personname'); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/migrations/2020_08_21_110811_create_person_name_fone_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('group')->nullable(); 19 | $table->integer('gid')->nullable(); 20 | $table->string('name')->nullable(); 21 | $table->string('type')->nullable(); 22 | $table->string('npfx')->nullable(); 23 | $table->string('givn')->nullable(); 24 | $table->string('nick')->nullable(); 25 | $table->string('spfx')->nullable(); 26 | $table->string('surn')->nullable(); 27 | $table->string('nsfx')->nullable(); 28 | $table->timestamps(); 29 | }); 30 | } 31 | 32 | /** 33 | * Reverse the migrations. 34 | * 35 | * @return void 36 | */ 37 | public function down() 38 | { 39 | Schema::dropIfExists('person_name_fone'); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/migrations/2020_08_21_111106_create_person_name_romn_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('group')->nullable(); 19 | $table->integer('gid')->nullable(); 20 | $table->string('name')->nullable(); 21 | $table->string('type')->nullable(); 22 | $table->string('npfx')->nullable(); 23 | $table->string('givn')->nullable(); 24 | $table->string('nick')->nullable(); 25 | $table->string('spfx')->nullable(); 26 | $table->string('surn')->nullable(); 27 | $table->string('nsfx')->nullable(); 28 | $table->timestamps(); 29 | }); 30 | } 31 | 32 | /** 33 | * Reverse the migrations. 34 | * 35 | * @return void 36 | */ 37 | public function down() 38 | { 39 | Schema::dropIfExists('person_name_romn'); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/migrations/2020_08_21_124830_create_source_ref_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('group')->nullable(); 19 | $table->integer('gid')->nullable(); 20 | $table->integer('sour_id')->nullable(); 21 | $table->string('text')->nullable(); 22 | $table->string('quay')->nullable(); 23 | $table->string('page')->nullable(); 24 | $table->timestamps(); 25 | }); 26 | } 27 | 28 | /** 29 | * Reverse the migrations. 30 | * 31 | * @return void 32 | */ 33 | public function down() 34 | { 35 | Schema::dropIfExists('source_ref'); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/migrations/2020_08_30_035717_create_media_objects_file_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('form')->nullable(); 19 | $table->string('medi')->nullable(); 20 | $table->timestamps(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | Schema::dropIfExists('media_objects_file'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/migrations/2020_08_31_092310_create_source_repo_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('group'); 19 | $table->integer('gid'); 20 | $table->string('repo_id'); 21 | $table->text('caln'); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('source_repo'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/migrations/2020_09_12_000100_update_person_events_table.php: -------------------------------------------------------------------------------- 1 | text('attr', 65535)->nullable()->change(); 20 | }); 21 | } 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | // 32 | Schema::table('person_events', function (Blueprint $table) { 33 | $table->dropColumn('attr'); 34 | }); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/migrations/2020_09_12_151600_add_column_for_media_objects_table.php: -------------------------------------------------------------------------------- 1 | string('rin')->nullable(); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | * 24 | * @return void 25 | */ 26 | public function down() 27 | { 28 | Schema::table('media_objects', function ($table) { 29 | $table->dropColumn('rin'); 30 | }); 31 | } 32 | } 33 | --------------------------------------------------------------------------------