├── .gitignore ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ └── sweep-template.yml └── workflows │ └── run-tests.yml ├── .DS_Store ├── src ├── .DS_Store ├── Facades │ ├── GedcomExpFacade.php │ ├── GedcomParserFacade.php │ └── GedcomXParserFacade.php ├── Models │ ├── Author.php │ ├── Publication.php │ ├── Subn.php │ ├── Citation.php │ ├── SourceRepo.php │ ├── Note.php │ ├── MediaObjeectFile.php │ ├── Chan.php │ ├── Repository.php │ ├── Place.php │ ├── FamilySlgs.php │ ├── MediaObject.php │ ├── Addr.php │ ├── Event.php │ ├── SourceDataEven.php │ ├── PersonAnci.php │ ├── PersonDesi.php │ ├── PersonSubm.php │ ├── ImportJob.php │ ├── PersonAlia.php │ ├── Refn.php │ ├── PersonAsso.php │ ├── PersonLds.php │ ├── SourceRefEven.php │ ├── SourceData.php │ ├── SourceRef.php │ ├── Subm.php │ ├── Source.php │ ├── PersonName.php │ ├── PersonNameFone.php │ ├── PersonNameRomn.php │ ├── FamilyEvent.php │ └── PersonEvent.php ├── Observers │ └── EventActionsObserver.php ├── Utils │ ├── Exporter │ │ ├── Indi │ │ │ ├── Even │ │ │ │ └── Plac.php │ │ │ ├── Alia.php │ │ │ ├── Desi.php │ │ │ ├── Anci.php │ │ │ ├── Subm.php │ │ │ ├── Asso.php │ │ │ └── Name │ │ │ │ ├── Romn.php │ │ │ │ └── Fone.php │ │ ├── Phon.php │ │ ├── Date.php │ │ ├── Refn.php │ │ ├── Caln.php │ │ ├── SourRef │ │ │ └── Even.php │ │ ├── Sour │ │ │ ├── Data │ │ │ │ └── Even.php │ │ │ ├── Data.php │ │ │ └── Repo.php │ │ ├── ObjeRef │ │ │ └── File.php │ │ ├── NoteRef.php │ │ ├── Chan.php │ │ ├── Addr.php │ │ ├── RepoRef.php │ │ ├── ObjeRef.php │ │ ├── Note.php │ │ ├── Subn.php │ │ ├── Fam │ │ │ └── Slgs.php │ │ └── Obje.php │ ├── Importer │ │ ├── Indi │ │ │ ├── Even │ │ │ │ └── Plac.php │ │ │ ├── Alia.php │ │ │ ├── Desi.php │ │ │ ├── Anci.php │ │ │ ├── Subm.php │ │ │ ├── Asso.php │ │ │ └── Name │ │ │ │ ├── Romn.php │ │ │ │ └── Fone.php │ │ ├── Phon.php │ │ ├── Date.php │ │ ├── Refn.php │ │ ├── Caln.php │ │ ├── SourRef │ │ │ └── Even.php │ │ ├── Sour │ │ │ ├── Data │ │ │ │ └── Even.php │ │ │ ├── Data.php │ │ │ └── Repo.php │ │ ├── ObjeRef │ │ │ └── File.php │ │ ├── NoteRef.php │ │ ├── Chan.php │ │ ├── Addr.php │ │ ├── RepoRef.php │ │ ├── ObjeRef.php │ │ ├── Note.php │ │ ├── Subn.php │ │ └── Fam │ │ │ └── Slgs.php │ ├── GedcomImporter.php │ └── GedcomExporter.php ├── factories │ ├── EventFactory.php │ ├── AuthorFactory.php │ ├── PlaceFactory.php │ ├── PersonFactory.php │ ├── PublicationFactory.php │ ├── ImportJobFactory.php │ ├── RefnFactory.php │ ├── PersonAnciFactory.php │ ├── ChanFactory.php │ ├── PersonSubmFactory.php │ ├── PersonDesiFactory.php │ ├── PersonAliaFactory.php │ ├── SourceDataEvenFactory.php │ ├── PersonAssoFactory.php │ ├── FamilySlgsFactory.php │ ├── SourceRefEvenFactory.php │ ├── MediaObjectFileFactory.php │ ├── NoteFactory.php │ ├── SourceDataFactory.php │ ├── MediaObjectFactory.php │ ├── SubnFactory.php │ ├── SourceRepoFactory.php │ ├── AddrFactory.php │ ├── SourceRefFactory.php │ ├── FamilyFactory.php │ ├── PersonLdsFactory.php │ ├── PersonNameFactory.php │ ├── PersonNameFoneFactory.php │ ├── PersonNameRomnFactory.php │ ├── CitationFactory.php │ ├── RepositoryFactory.php │ ├── SubmFactory.php │ ├── FamilyEventFactory.php │ ├── PersonEventFactory.php │ └── SourceFactory.php ├── migrations │ ├── 2020_09_12_151600_add_column_for_media_objects_table.php │ ├── 2021_05_28_122429_add_index_key_person_name_table.php │ ├── 2021_08_25_173355_drop_column_chan_to_people_table.php │ ├── 2021_08_25_173444_add_column_chan_to_people_table.php │ ├── 2021_08_26_203720_remove_column_chan_to_people_table.php │ ├── 2021_08_26_203800_add_microsecond_in_column_chan_to_people_table.php │ ├── 2021_05_28_121232_add_index_key_person_event_table.php │ ├── 2020_04_10_155134_create_places_table.php │ ├── 2020_04_24_211718_create_authors_table.php │ ├── 2020_08_30_035717_create_media_objects_file_table.php │ ├── 2021_08_27_192146_add_column_titl_and_chr_to_people_table.php │ ├── 2020_04_10_171030_create_types_table.php │ ├── 2020_04_24_211852_create_publications_table.php │ ├── 2020_06_24_094758_create_person_subm_table.php │ ├── 2020_06_24_095241_create_person_anci_table.php │ ├── 2020_10_13_093608_create_person_desi_table.php │ ├── 2020_08_31_092310_create_source_repo_table.php │ ├── 2020_06_23_031852_create_importjobs_table.php │ ├── 2020_06_24_103355_create_refn_table.php │ ├── 2020_06_24_135407_create_chans_table.php │ ├── 2020_06_13_003901_create_media_objects_table.php │ ├── 2020_06_24_090326_create_sourceref_even_table.php │ ├── 2020_09_12_000100_update_person_events_table.php │ ├── 2021_08_25_121115_add_column_birth_year_and_death_year_to_people_table.php │ ├── 2021_08_25_155050_add_column_burialday_and_burial_year_to_people_table.php │ ├── 2020_06_24_085159_create_source_data_even_table.php │ ├── 2020_06_24_092055_create_person_alia_table.php │ ├── 2020_06_24_084354_create_sourcedata_table.php │ ├── 2021_08_25_031507_set_string_column_husband_id_and_wife_id_to_families_table.php │ ├── 2020_06_25_040418_create_family_slgs_table.php │ ├── 2020_06_24_093608_create_person_asso_table.php │ ├── 2020_06_11_175726_update_add_columns_family_table.php │ ├── 2020_06_25_052028_create_addrs_table.php │ ├── 2020_08_21_124830_create_source_ref_table.php │ ├── 2021_08_27_183956_add_column_month_to_people_table.php │ ├── 2020_06_11_152802_update_description_default_places_table.php │ ├── 2020_06_12_173700_create_subns_table.php │ ├── 2021_05_28_121021_add_index_key_people_table.php │ ├── 2020_04_10_154850_create_families_table.php │ ├── 2020_04_10_154637_create_citations_table.php │ ├── 2020_06_24_105140_create_person_lds_table.php │ ├── 2020_06_01_112242_create_family_events_table.php │ ├── 2020_04_10_155019_create_notes_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_06_12_190711_create_subm_table.php │ ├── 2020_06_11_173643_update_add_columns_people_table.php │ ├── 2020_01_01_120000_create_default_people_table.php │ ├── 2020_04_10_155307_create_repositories_table.php │ ├── 2021_08_26_222539_add_column_dati_plac_famc_fams_to_people_table.php │ ├── 2020_06_01_112223_create_persons_events_table.php │ ├── 2020_04_10_155413_create_sources_table.php │ ├── 2020_06_01_112312_update_events_add_timestamp.php │ └── 2020_06_03_192100_add_columns_for_people_table.php ├── Commands │ └── GedcomImporter.php ├── Events │ └── GedComProgressSent.php └── ServiceProvider.php ├── tests ├── TestCase.php └── Unit │ ├── ServiceProviderTest.php │ ├── GedcomImporterTest.php │ ├── FamilyParserTest.php │ ├── IndividualParserTest.php │ └── ProgressReporterTest.php ├── phpunit.xml ├── rector.php ├── composer.json ├── CONTRIBUTE.md ├── LICENSE.md └── sweep.yaml /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | vendor/ 3 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: liberu-genealogy 2 | -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liberu-genealogy/laravel-gedcom/HEAD/.DS_Store -------------------------------------------------------------------------------- /src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liberu-genealogy/laravel-gedcom/HEAD/src/.DS_Store -------------------------------------------------------------------------------- /src/Facades/GedcomExpFacade.php: -------------------------------------------------------------------------------- 1 | false]; 12 | 13 | protected $casts = ['is_active' => 'boolean']; 14 | } 15 | -------------------------------------------------------------------------------- /src/Observers/EventActionsObserver.php: -------------------------------------------------------------------------------- 1 | date); 12 | $model->fill($parser->parse_date()); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Models/Publication.php: -------------------------------------------------------------------------------- 1 | false]; 12 | 13 | protected $casts = ['is_active' => 'boolean']; 14 | } 15 | -------------------------------------------------------------------------------- /src/Facades/GedcomParserFacade.php: -------------------------------------------------------------------------------- 1 | getPlac(); 18 | } 19 | 20 | return $place; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Utils/Importer/Indi/Even/Plac.php: -------------------------------------------------------------------------------- 1 | getPlac(); 18 | } 19 | 20 | return $place; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | false]; 12 | 13 | protected $casts = ['is_active' => 'boolean']; 14 | 15 | public function sources() 16 | { 17 | return $this->belongsToMany(Source::class); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | tests/Unit 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/Utils/GedcomImporter.php: -------------------------------------------------------------------------------- 1 | paths([ 13 | __DIR__ . '/src' 14 | ]); 15 | 16 | // register a single rule 17 | $rectorConfig->sets([ 18 | SetList::DEAD_CODE, 19 | SetList::CODE_QUALITY, 20 | LaravelSetList::LARAVEL_100, 21 | LevelSetList::UP_TO_PHP_82 22 | ]); 23 | }; 24 | -------------------------------------------------------------------------------- /src/Models/Note.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/MediaObjeectFile.php: -------------------------------------------------------------------------------- 1 | getPhon(); 19 | } 20 | } elseif (is_array($phon)) { 21 | return json_encode($phon, JSON_THROW_ON_ERROR); 22 | } else { 23 | return "$phon"; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Utils/Importer/Phon.php: -------------------------------------------------------------------------------- 1 | getPhon(); 19 | } 20 | } elseif (is_array($phon)) { 21 | return json_encode($phon, JSON_THROW_ON_ERROR); 22 | } else { 23 | return "$phon"; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tests/Unit/ServiceProviderTest.php: -------------------------------------------------------------------------------- 1 | app->singleton('FamilyTree365/laravel-gedcom:parser', function() { 13 | return new GedcomParser(); 14 | }); 15 | 16 | $parserInstanceOne = app('FamilyTree365/laravel-gedcom:parser'); 17 | $parserInstanceTwo = app('FamilyTree365/laravel-gedcom:parser'); 18 | 19 | $this->assertSame($parserInstanceOne, $parserInstanceTwo); 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /src/Models/Chan.php: -------------------------------------------------------------------------------- 1 | getDate(); 21 | } 22 | } else { 23 | // $input_date = Carbon::parse($input_date)->timestamp; 24 | return "$input_date"; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Utils/Importer/Date.php: -------------------------------------------------------------------------------- 1 | getDate(); 21 | } 22 | } else { 23 | // $input_date = Carbon::parse($input_date)->timestamp; 24 | return "$input_date"; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/factories/AuthorFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->words(), 'is_active', 'name' => $this->faker->name(), 27 | ]; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Models/Repository.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/Utils/Exporter/Indi/Alia.php: -------------------------------------------------------------------------------- 1 | $group, 'gid'=>$group_id, 'alia'=>$alia]; 20 | $aliaData[] = $data; 21 | } 22 | } 23 | app(PersonAlia::class)->on($conn)->insert($aliaData); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Utils/Importer/Indi/Alia.php: -------------------------------------------------------------------------------- 1 | $group, 'gid'=>$group_id, 'alia'=>$alia]; 20 | $aliaData[] = $data; 21 | } 22 | } 23 | app(PersonAlia::class)->on($conn)->insert($aliaData); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Models/Place.php: -------------------------------------------------------------------------------- 1 | where('title', $title)->first(); 18 | if ($place !== null) { 19 | $id = $place->id; 20 | } else { 21 | $place = self::query()->create(['title' => $title]); 22 | $id = $place->id; 23 | } 24 | 25 | return $id; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/factories/PlaceFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->words(), 'title' => $this->faker->word(), 'date' => $this->faker->date(), 27 | ]; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/factories/PersonFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->name(), 'email' => $this->faker->email(), 'phone' => $this->faker->phoneNumber(), 27 | ]; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/factories/PublicationFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->text(), 'is_active', 'name' => $this->faker->word(), 27 | ]; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/factories/ImportJobFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->randomElement(1, 2), 'slug' => $this->faker->word(), 'status', 'created_at', 'updated_at', 27 | ]; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/factories/RefnFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->word(), 'gid' => $this->faker->randomElement('1', '2'), 'refn' => $this->faker->word(), 'type' => $this->faker->word(), 27 | ]; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Models/FamilySlgs.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 | app(MRefn::class)->on($conn)->updateOrCreate($key, $data); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /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 | app(MRefn::class)->on($conn)->updateOrCreate($key, $data); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/factories/PersonAnciFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->word(), 'gid' => $this->faker->randomElement('1', '2'), 'anci' => $this->faker->word(), 'created_at', 'updated_at', 27 | ]; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Models/Addr.php: -------------------------------------------------------------------------------- 1 | $group, 'gid'=>$group_id, 'desi'=>$desi]; 20 | $data = ['group'=>$group, 'gid'=>$group_id, 'desi'=>$desi]; 21 | $record = app(PersonDesi::class)->on($conn)->updateOrCreate($key, $data); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Utils/Importer/Indi/Desi.php: -------------------------------------------------------------------------------- 1 | $group, 'gid'=>$group_id, 'desi'=>$desi]; 20 | $data = ['group'=>$group, 'gid'=>$group_id, 'desi'=>$desi]; 21 | $record = app(PersonDesi::class)->on($conn)->updateOrCreate($key, $data); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/factories/ChanFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->word(), 'gid' => $this->faker->randomElement(1, 2), 'date' => $this->faker->date(), 'time' => $this->faker->time(), 'created_at', 'updated_at', 27 | ]; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/factories/PersonSubmFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->word(), 'gid' => $this->faker->randomElement('1', '2'), 'subm' => $this->faker->word(), , 'created_at', 'updated_at', 27 | ]; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/factories/PersonDesiFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->word(), 'gid' => $this->faker->randomElement('1', '2'), 27 | 'desi' => $this->faker->word(), , 'created_at', 'updated_at', 28 | ]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/factories/PersonAliaFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->word(), 'gid' => $this->faker->randomElement('1', '2'), 27 | $this->faker->word(), 'import_confirm', 'created_at', 'updated_at', 28 | ]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/sweep-template.yml: -------------------------------------------------------------------------------- 1 | name: Sweep Issue 2 | title: 'Sweep: ' 3 | description: For small bugs, features, refactors, and tests to be handled by Sweep, an AI-powered junior developer. 4 | labels: sweep 5 | body: 6 | - type: textarea 7 | id: description 8 | attributes: 9 | label: Details 10 | description: Tell Sweep where and what to edit and provide enough context for a new developer to the codebase 11 | placeholder: | 12 | Unit Tests: Write unit tests for . Test each function in the file. Make sure to test edge cases. 13 | Bugs: The bug might be in . Here are the logs: ... 14 | Features: the new endpoint should use the ... class from because it contains ... logic. 15 | Refactors: We are migrating this function to ... version because ... -------------------------------------------------------------------------------- /src/Models/Event.php: -------------------------------------------------------------------------------- 1 | hasOne(Place::class, 'id', 'places_id'); 16 | } 17 | 18 | public function getPlacename() 19 | { 20 | return $this->place ? $this->place->title : 'unknown place'; 21 | } 22 | 23 | public function getTitle() 24 | { 25 | return $this->gedcom_event_names[$this->title] ?? $this->title; 26 | } 27 | 28 | public function scopeOrderByDate($query) 29 | { 30 | return $query->orderBy('year')->orderBy('month')->orderBy('day'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Utils/Exporter/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 | app(MCaln::class)->on($conn)->updateOrCreate($key, $data); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /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 | app(MCaln::class)->on($conn)->updateOrCreate($key, $data); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Models/SourceDataEven.php: -------------------------------------------------------------------------------- 1 | string('rin')->nullable(); 17 | }); 18 | } 19 | 20 | /** 21 | * Reverse the migrations. 22 | * 23 | * @return void 24 | */ 25 | public function down() 26 | { 27 | Schema::table('media_objects', function ($table) { 28 | $table->dropColumn('rin'); 29 | }); 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /src/Utils/Exporter/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 | app(SourceRefEven::class)->on($conn)->updateOrCreate($key, $data); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /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 | app(SourceRefEven::class)->on($conn)->updateOrCreate($key, $data); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/migrations/2021_05_28_122429_add_index_key_person_name_table.php: -------------------------------------------------------------------------------- 1 | index(['id', 'gid']); 17 | }); 18 | } 19 | 20 | /** 21 | * Reverse the migrations. 22 | * 23 | * @return void 24 | */ 25 | public function down() 26 | { 27 | Schema::table('person_name', function (Blueprint $table) { 28 | $table->dropIndex(['id', 'gid']); 29 | }); 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /src/Models/PersonAnci.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 | app(SourceDataEven::class)->on($conn)->updateOrCreate($key, $data); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /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 | app(SourceDataEven::class)->on($conn)->updateOrCreate($key, $data); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /.github/workflows/run-tests.yml: -------------------------------------------------------------------------------- 1 | name: Tests 2 | 3 | on: [push] 4 | 5 | jobs: 6 | laravel-tests: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - name: Setup PHP 10 | uses: shivammathur/setup-php@v2 11 | with: 12 | php-version: '8.4' 13 | - name: Install host app 14 | run: composer create-project --prefer-dist laravel/laravel host 15 | 16 | - name: Install package (this repo) 17 | uses: actions/checkout@v2 18 | with: 19 | path: host/packages/liberu-genealogy/laravel-gedcom 20 | 21 | - name: Require this package 22 | working-directory: ./host 23 | run: composer require liberu-genealogy/laravel-gedcom 24 | 25 | - name: Run tests 26 | working-directory: ./host 27 | run: vendor/phpunit/phpunit/phpunit packages/liberu-genealogy/laravel-gedcom/tests 28 | -------------------------------------------------------------------------------- /src/Models/ImportJob.php: -------------------------------------------------------------------------------- 1 | $this->faker->word(), 'gid' => $this->faker->randomElement('1', '2'), 27 | 'date' => $this->faker->date(), 'plac' => $this->faker->word(), 'created_at', 'updated_at', 28 | ]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/factories/PersonAssoFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->word(), 'gid' => $this->faker->randomElement('1', '2'), 27 | 'indi' => $this->faker->word(), 'rela'=> $this->faker->word(), 'import_confirm', 'created_at', 'updated_at', 28 | ]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/migrations/2021_08_25_173355_drop_column_chan_to_people_table.php: -------------------------------------------------------------------------------- 1 | dropColumn('chan'); 17 | }); 18 | } 19 | 20 | /** 21 | * Reverse the migrations. 22 | * 23 | * @return void 24 | */ 25 | public function down() 26 | { 27 | Schema::table('people', function (Blueprint $table) { 28 | $table->string('chan')->nullable()->after('deleted_at'); 29 | }); 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /src/migrations/2021_08_25_173444_add_column_chan_to_people_table.php: -------------------------------------------------------------------------------- 1 | dateTime('chan')->nullable()->after('deleted_at'); 17 | }); 18 | } 19 | 20 | /** 21 | * Reverse the migrations. 22 | * 23 | * @return void 24 | */ 25 | public function down() 26 | { 27 | Schema::table('people', function (Blueprint $table) { 28 | $table->dropColumn('chan'); 29 | }); 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /src/Models/PersonAlia.php: -------------------------------------------------------------------------------- 1 | dropColumn('chan'); 17 | }); 18 | } 19 | 20 | /** 21 | * Reverse the migrations. 22 | * 23 | * @return void 24 | */ 25 | public function down() 26 | { 27 | Schema::table('people', function (Blueprint $table) { 28 | $table->dateTime('chan')->nullable()->after('deleted_at'); 29 | }); 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /src/Models/Refn.php: -------------------------------------------------------------------------------- 1 | 'gedcomx-progress', 'eventName' => 'newMessage']) 11 | * @method static bool isGedcomXFile(string $filename) 12 | * 13 | * @see \FamilyTree365\LaravelGedcom\Utils\GedcomXParser 14 | */ 15 | class GedcomXParserFacade extends Facade 16 | { 17 | /** 18 | * Get the registered name of the component. 19 | * 20 | * @return string 21 | */ 22 | protected static function getFacadeAccessor() 23 | { 24 | return 'gedcomx-parser'; 25 | } 26 | } -------------------------------------------------------------------------------- /src/Models/PersonAsso.php: -------------------------------------------------------------------------------- 1 | string('chan')->nullable()->after('deleted_at'); 17 | }); 18 | } 19 | 20 | /** 21 | * Reverse the migrations. 22 | * 23 | * @return void 24 | */ 25 | public function down() 26 | { 27 | Schema::table('people', function (Blueprint $table) { 28 | $table->dropColumn('chan'); 29 | }); 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liberu-genealogy/laravel-gedcom", 3 | "description": "A package that converts gedcom files to Eloquent models", 4 | "type": "library", 5 | "require": { 6 | "php": ">=8.4", 7 | "liberu-genealogy/php-gedcom": "^4.1.0", 8 | "illuminate/support": "^11.0||^12.0", 9 | "illuminate/database": "^11.0||^12.0" 10 | }, 11 | "license": "MIT", 12 | "autoload": { 13 | "psr-4": { 14 | "FamilyTree365\\LaravelGedcom\\": "src/" 15 | } 16 | }, 17 | "extra": { 18 | "laravel": { 19 | "providers": [ 20 | "FamilyTree365\\LaravelGedcom\\ServiceProvider" 21 | ] 22 | } 23 | }, 24 | "require-dev": { 25 | "rector/rector": "^1.0.0", 26 | "driftingly/rector-laravel": "^1.2.0", 27 | "phpunit/phpunit": "^10.0||^11.0||^12.0", 28 | "laravel/framework": "^10.0||^11.0||^12.0" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/migrations/2021_05_28_121232_add_index_key_person_event_table.php: -------------------------------------------------------------------------------- 1 | index(['id', 'person_id', 'addr_id']); 17 | }); 18 | } 19 | 20 | /** 21 | * Reverse the migrations. 22 | * 23 | * @return void 24 | */ 25 | public function down() 26 | { 27 | Schema::table('person_events', function (Blueprint $table) { 28 | $table->dropIndex(['id', 'person_id', 'addr_id']); 29 | }); 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /src/Models/PersonLds.php: -------------------------------------------------------------------------------- 1 | Family::factory(), 'stat' => $this->faker->words(), 28 | 'date' => $this->faker->date(), 'plac' => $this->faker->word(), 'temp' => $this->faker->word(), 'created_at', 'updated_at', 29 | ]; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/factories/SourceRefEvenFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->word(), 27 | 'gid' => $this->faker->randomElement('1', '2'), 28 | 'even' => $this->faker->word(), 29 | 'role' => $this->faker->word(), 'created_at', 'updated_at', 30 | ]; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Models/SourceRefEven.php: -------------------------------------------------------------------------------- 1 | $this->faker->word(), 'gid' => $this->faker->randomElement('1', '2'), 27 | 'form' => $this->faker->word(), 'medi' => $this->faker->word(), 'type' => $this->faker->word(), 'created_at', 'updated_at', 28 | ]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Utils/Exporter/Indi/Anci.php: -------------------------------------------------------------------------------- 1 | $group, 'gid'=>$group_id, 'anci'=>$subm_id]; 22 | $data = ['group'=>$group, 'gid'=>$group_id, 'anci'=>$subm_id]; 23 | $record[] = $data; 24 | } 25 | } 26 | PersonAnci::insert($record); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Utils/Importer/Indi/Anci.php: -------------------------------------------------------------------------------- 1 | $group, 'gid'=>$group_id, 'anci'=>$subm_id]; 22 | $data = ['group'=>$group, 'gid'=>$group_id, 'anci'=>$subm_id]; 23 | $record[] = $data; 24 | } 25 | } 26 | PersonAnci::insert($record); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/migrations/2020_04_10_155134_create_places_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string('title'); 18 | $table->text('description'); 19 | $table->string('date')->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('places'); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /src/migrations/2020_04_24_211718_create_authors_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string('name'); 18 | $table->string('description'); 19 | $table->integer('is_active'); 20 | $table->timestamps(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | Schema::dropIfExists('authors'); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /src/migrations/2020_08_30_035717_create_media_objects_file_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string('form')->nullable(); 18 | $table->string('medi')->nullable(); 19 | $table->timestamps(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::dropIfExists('media_objects_file'); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /src/migrations/2021_08_27_192146_add_column_titl_and_chr_to_people_table.php: -------------------------------------------------------------------------------- 1 | string('titl')->nullable(); 17 | $table->string('chr')->nullable(); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | * 24 | * @return void 25 | */ 26 | public function down() 27 | { 28 | Schema::table('people', function (Blueprint $table) { 29 | $table->dropColumn(['titl', 'chr']); 30 | }); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /src/factories/NoteFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->word(), 'gid' => $this->faker->randomElement('1', '2'), 27 | 'note' => $this->faker->text(), 'rin' => $this->faker->word(), 'name' => $this->faker->word(), 28 | 'description' => $this->faker->text(), 'is_active', 'type_id', 29 | ]; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/factories/SourceDataFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->word(), 'gid' => $this->faker->randomElement('1', '2'), 27 | 'date' => $this->faker->date(), 28 | 'text' => $this->faker->text(), 29 | 'agnc' => $this->faker->word(), 'created_at', 'updated_at', 30 | ]; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/migrations/2020_04_10_171030_create_types_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | // $table->string('name'); 18 | // $table->string('description'); 19 | // $table->integer('is_active'); 20 | // $table->timestamps(); 21 | // }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | // Schema::dropIfExists('types'); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /src/factories/MediaObjectFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->word(), 'gid' => $this->faker->randomElement('1', '2'), 27 | 'titl' => $this->faker->word(), , 'obje_id' => $this->faker->randomElement('1', '2'), 28 | 'rin' => $this->faker->word(), 'created_at', 'updated_at', 29 | ]; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/factories/SubnFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->word(), 'famf' => $this->faker->word(), 'temp' => $this->faker->word(), 28 | 'ance' => $this->faker->word(), 'desc' => $this->faker->randomElement('0', '1'), 29 | 'ordi' => $this->faker->word(), 'rin' => $this->faker->word(), 30 | ]; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/migrations/2020_04_24_211852_create_publications_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string('name'); 18 | $table->string('description'); 19 | $table->integer('is_active'); 20 | 21 | $table->timestamps(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::dropIfExists('publications'); 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /tests/Unit/GedcomImporterTest.php: -------------------------------------------------------------------------------- 1 | put('test.ged', 'Valid GEDCOM content'); 22 | 23 | GedcomParserFacade::shouldReceive('parse') 24 | ->once() 25 | ->andReturn(true); 26 | 27 | $importer = new GedcomImporter(); 28 | $result = $importer->handle('test.ged'); 29 | 30 | $this->assertTrue($result); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Models/SourceData.php: -------------------------------------------------------------------------------- 1 | $group, 'gid'=>$group_id, 'subm'=>$subm_id]; 22 | $data = ['group'=>$group, 'gid'=>$group_id, 'subm'=>$subm_id]; 23 | $record[] = $data; 24 | } 25 | } 26 | 27 | app(PersonSubm::class)->on($conn)->insert($record); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Utils/Importer/Indi/Subm.php: -------------------------------------------------------------------------------- 1 | $group, 'gid'=>$group_id, 'subm'=>$subm_id]; 22 | $data = ['group'=>$group, 'gid'=>$group_id, 'subm'=>$subm_id]; 23 | $record[] = $data; 24 | } 25 | } 26 | 27 | app(PersonSubm::class)->on($conn)->insert($record); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/factories/SourceRepoFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->word(), 28 | 'gid' => $this->faker->randomElement('1', '2'), 29 | 'repo_id' => Repository::factory(), 30 | 'caln' => $this->faker->word(), 31 | 'created_at', 'updated_at', 32 | ]; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/migrations/2020_06_24_094758_create_person_subm_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string('group')->nullable(); 18 | $table->integer('gid')->nullable(); 19 | $table->string('subm')->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('person_subm'); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /src/migrations/2020_06_24_095241_create_person_anci_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string('group')->nullable(); 18 | $table->integer('gid')->nullable(); 19 | $table->string('anci')->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('person_anci'); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /src/migrations/2020_10_13_093608_create_person_desi_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string('group')->nullable(); 18 | $table->integer('gid')->nullable(); 19 | $table->string('desi')->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('person_desi'); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /src/migrations/2020_08_31_092310_create_source_repo_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string('group'); 18 | $table->integer('gid'); 19 | $table->string('repo_id'); 20 | $table->text('caln'); 21 | $table->timestamps(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::dropIfExists('source_repo'); 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /src/migrations/2020_06_23_031852_create_importjobs_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->unsignedBigInteger('user_id')->nullable(); 18 | $table->string('slug')->nullable(); 19 | $table->string('status')->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('importjobs'); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /src/factories/AddrFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->address(), 27 | 'adr2' => $this->faker->address(), 28 | 'city' => $this->faker->city(), 29 | 'stae' => $this->faker->state(), 30 | 'post' => $this->faker->postcode(), 31 | 'ctry' => $this->faker->countryCode(), 'created_at', 'updated_at', 32 | ]; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/factories/SourceRefFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->word(), 28 | 'gid' => $this->faker->randomElement('1', '2'), 'sour_id' => Source::factory(), 29 | 'text' => $this->faker->word(), 'quay' => $this->faker->word(), 'page' => $this->faker->word(), 'created_at', 'updated_at', 30 | ]; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Utils/Exporter/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 | app(MediaObjeectFile::class)->on($conn)->updateOrCreate($key, $data); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /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 | app(MediaObjeectFile::class)->on($conn)->updateOrCreate($key, $data); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/factories/FamilyFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->text(), 'is_active', 'husband_id'=> $this->faker->randomElement(1, 2, 3), 'wife_id'=> $this->faker->randomElement(1, 2, 3), 'type_id' => Type::factory(), 28 | 'chan' => $this->faker->words(), 'nchi' => $this->faker->words(), 'rin' => $this->faker->word(), 29 | ]; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/migrations/2020_06_24_103355_create_refn_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string('group')->nullable(); 18 | $table->integer('gid')->nullable(); 19 | $table->string('refn')->nullable(); 20 | $table->string('type')->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('refn'); 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /src/Models/SourceRef.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string('group')->nullable(); 18 | $table->integer('gid')->nullable(); 19 | $table->string('date')->nullable(); 20 | $table->string('time')->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('chans'); 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /src/Models/Subm.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->integer('gid')->nullable(); 18 | $table->string('group')->nullable(); 19 | $table->string('titl')->nullable(); 20 | $table->string('obje_id')->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('media_objects'); 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /src/migrations/2020_06_24_090326_create_sourceref_even_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string('group')->nullable(); 18 | $table->integer('gid')->nullable(); 19 | $table->string('even')->nullable(); 20 | $table->string('role')->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('sourceref_even'); 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /src/migrations/2020_09_12_000100_update_person_events_table.php: -------------------------------------------------------------------------------- 1 | text('attr')->nullable()->change(); 19 | }); 20 | } 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | // 31 | Schema::table('person_events', function (Blueprint $table) { 32 | $table->text('attr')->nullable(false)->change(); 33 | }); 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /src/migrations/2021_08_25_121115_add_column_birth_year_and_death_year_to_people_table.php: -------------------------------------------------------------------------------- 1 | smallInteger('birth_year')->nullable()->after('birthday'); 17 | $table->smallInteger('death_year')->nullable()->after('deathday'); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | * 24 | * @return void 25 | */ 26 | public function down() 27 | { 28 | Schema::table('people', function (Blueprint $table) { 29 | $table->dropColumn(['birth_year', 'death_year']); 30 | }); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /src/migrations/2021_08_25_155050_add_column_burialday_and_burial_year_to_people_table.php: -------------------------------------------------------------------------------- 1 | string('burial_day')->nullable()->after('death_year'); 17 | $table->smallInteger('burial_year')->nullable()->after('burial_day'); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | * 24 | * @return void 25 | */ 26 | public function down() 27 | { 28 | Schema::table('people', function (Blueprint $table) { 29 | $table->dropColumn(['burial_day', 'burial_year']); 30 | }); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /CONTRIBUTE.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Contributions are **welcome** and will be fully **credited**. We accept contributions via Pull Requests on [Github](https://github.com/familytree365/laravel-gedcom). 4 | 5 | ## Pull Requests 6 | 7 | - **[PSR-4 Coding Standard.]** The easiest way to apply the conventions is to install [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer). 8 | - **Document any change in behaviour.** Make sure the `README.md` and any other relevant documentation are kept up-to-date. 9 | - **Create feature branches.** Don't ask us to pull from your master branch. 10 | - **One pull request per feature.** If you want to do more than one thing, send multiple pull requests. 11 | - **Send coherent history.** Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting. -------------------------------------------------------------------------------- /src/migrations/2020_06_24_085159_create_source_data_even_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string('group')->nullable(); 18 | $table->string('gid')->nullable(); 19 | $table->string('date')->nullable(); 20 | $table->string('plac')->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('source_data_even'); 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /src/migrations/2020_06_24_092055_create_person_alia_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string('group')->nullable(); 18 | $table->integer('gid')->nullable(); 19 | $table->string('alia')->nullable(); 20 | $table->integer('import_confirm')->default(0); 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_alia'); 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /src/factories/PersonLdsFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->word(), 'gid' => $this->faker->randomElement('1', '2'), 27 | 'type' => $this->faker->word(), 'stat' => $this->faker->word(), 28 | 'date' => $this->faker->date(), 'plac' => $this->faker->word(), 29 | 'temp' => $this->faker->text(), 'slac_famc' => $this->faker->word(), 'created_at', 'updated_at', 30 | ]; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Utils/Exporter/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 = app(Note::class)->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 | foreach ($sour as $item) { 29 | SourRef::read($conn, $item, $_group, $_gid); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /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 = app(Note::class)->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 | foreach ($sour as $item) { 29 | SourRef::read($conn, $item, $_group, $_gid); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/factories/PersonNameFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->word(), 'gid' => $this->faker->randomElement('1', '2'), 27 | 'type' => $this->faker->word(), 'name' => $this->faker->name(), 28 | 'npfx' => $this->faker->word(), 'givn' => $this->faker->firstName(), 29 | 'nick' => $this->faker->userName(), 'spfx', 'surn' => $this->faker->lastName(), 'nsfx', 'created_at', 'updated_at', 30 | ]; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/migrations/2020_06_24_084354_create_sourcedata_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string('group')->nullable(); 18 | $table->integer('gid')->nullable(); 19 | $table->string('date')->nullable(); 20 | $table->string('text')->nullable(); 21 | $table->string('agnc')->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'); 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /src/migrations/2021_08_25_031507_set_string_column_husband_id_and_wife_id_to_families_table.php: -------------------------------------------------------------------------------- 1 | string('husband_id')->nullable()->change(); 17 | $table->string('wife_id')->nullable()->change(); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | * 24 | * @return void 25 | */ 26 | public function down() 27 | { 28 | Schema::table('families', function (Blueprint $table) { 29 | $table->integer('husband_id')->nullable()->change(); 30 | $table->integer('wife_id')->nullable()->change(); 31 | }); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /src/migrations/2020_06_25_040418_create_family_slgs_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->integer('family_id')->nullable(); 18 | $table->string('stat')->nullable(); 19 | $table->string('date')->nullable(); 20 | $table->string('plac')->nullable(); 21 | $table->string('temp')->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('family_slgs'); 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /src/factories/PersonNameFoneFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->word(), 'gid' => $this->faker->randomElement('1', '2'), 27 | 'type' => $this->faker->word(), 'name' => $this->faker->name(), 28 | 'npfx' => $this->faker->word(), 'givn' => $this->faker->firstName(), 29 | 'nick' => $this->faker->userName(), 'spfx', 'surn' => $this->faker->lastName(), 'nsfx', 'created_at', 'updated_at', 30 | ]; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/migrations/2020_06_24_093608_create_person_asso_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string('group')->nullable(); 18 | $table->integer('gid')->nullable(); 19 | $table->string('indi')->nullable(); 20 | $table->string('rela')->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_asso'); 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /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/migrations/2020_06_11_175726_update_add_columns_family_table.php: -------------------------------------------------------------------------------- 1 | string('chan')->nullable(); 18 | $table->string('nchi')->nullable(); 19 | $table->string('rin')->nullable(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | // 31 | Schema::table('families', function (Blueprint $table) { 32 | $table->dropColumn('chan'); 33 | $table->dropColumn('nchi'); 34 | $table->dropColumn('rin'); 35 | }); 36 | } 37 | }; 38 | -------------------------------------------------------------------------------- /src/factories/PersonNameRomnFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->word(), 'gid' => $this->faker->randomElement('1', '2'), 28 | 'type' => $this->faker->word(), 'name' => $this->faker->name(), 29 | 'npfx' => $this->faker->word(), 'givn' => $this->faker->firstName(), 30 | 'nick' => $this->faker->userName(), 'spfx', 'surn' => $this->faker->lastName(), 'nsfx', 'created_at', 'updated_at', 31 | ]; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/migrations/2020_06_25_052028_create_addrs_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string('adr1')->nullable(); 18 | $table->string('adr2')->nullable(); 19 | $table->string('city')->nullable(); 20 | $table->string('stae')->nullable(); 21 | $table->string('post')->nullable(); 22 | $table->string('ctry')->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('addrs'); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /src/migrations/2020_08_21_124830_create_source_ref_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string('group')->nullable(); 18 | $table->integer('gid')->nullable(); 19 | $table->integer('sour_id')->nullable(); 20 | $table->string('text')->nullable(); 21 | $table->string('quay')->nullable(); 22 | $table->string('page')->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_ref'); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /src/migrations/2021_08_27_183956_add_column_month_to_people_table.php: -------------------------------------------------------------------------------- 1 | unsignedTinyInteger('birth_month')->nullable()->after('birthday'); 17 | $table->unsignedTinyInteger('death_month')->nullable()->after('deathday'); 18 | $table->unsignedTinyInteger('burial_month')->nullable()->after('burial_day'); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | * 25 | * @return void 26 | */ 27 | public function down() 28 | { 29 | Schema::table('people', function (Blueprint $table) { 30 | $table->dropColumn(['birth_month', 'death_month', 'burial_month']); 31 | }); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /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. -------------------------------------------------------------------------------- /src/factories/CitationFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->word(), 'description' => $this->faker->text(), 28 | 'repository_id' => Repository::factory(), 29 | 'volume' => $this->faker->randomElement(1, 2, 3, 4, 5), 30 | 'page' => $this->faker->randomNumber(500), 'is_active', 31 | 'confidence' => $this->faker->word(), 32 | 'source_id' => $this->faker->randomElement(1, 2, 3, 4), 33 | 34 | ]; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Models/PersonName.php: -------------------------------------------------------------------------------- 1 | dropColumn('description'); 19 | }); 20 | } 21 | Schema::table('places', function (Blueprint $table) { 22 | $table->text('description')->nullable()->after('date'); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | // 34 | Schema::table('places', function (Blueprint $table) { 35 | $table->dropColumn('description'); 36 | }); 37 | } 38 | }; 39 | -------------------------------------------------------------------------------- /src/migrations/2020_06_12_173700_create_subns_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string('subm')->nullable(); 18 | $table->string('famf')->nullable(); 19 | $table->string('temp')->nullable(); 20 | $table->string('ance')->nullable(); 21 | $table->string('desc')->nullable(); 22 | $table->string('ordi')->nullable(); 23 | $table->string('rin')->nullable(); 24 | 25 | $table->timestamps(); 26 | }); 27 | } 28 | 29 | /** 30 | * Reverse the migrations. 31 | * 32 | * @return void 33 | */ 34 | public function down() 35 | { 36 | Schema::dropIfExists('subns'); 37 | } 38 | }; 39 | -------------------------------------------------------------------------------- /src/Models/PersonNameFone.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 = app(MChan::class)->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 | foreach ($note as $item) { 30 | if ($item) { 31 | NoteRef::read($conn, $item, $_group, $_gid); 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /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 = app(MChan::class)->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 | foreach ($note as $item) { 30 | if ($item) { 31 | NoteRef::read($conn, $item, $_group, $_gid); 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/migrations/2021_05_28_121021_add_index_key_people_table.php: -------------------------------------------------------------------------------- 1 | index(['id', 'uid']); 19 | } 20 | }); 21 | } 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | if (Schema::hasTable('people')) { 32 | Schema::table('people', function (Blueprint $table) { 33 | if (Schema::hasColumn('people', 'uid')) { 34 | $table->dropIndex(['id', 'uid']); 35 | } 36 | }); 37 | } 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /src/migrations/2020_04_10_154850_create_families_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 17 | $table->text('description')->nullable(); 18 | $table->integer('is_active')->nullable(); 19 | $table->integer('type_id')->nullable(); 20 | $table->integer('husband_id')->references('id')->on('persons')->nullable(); 21 | $table->integer('wife_id')->references('id')->on('persons')->nullable(); 22 | $table->timestamps(); 23 | $table->softDeletes(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('families'); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /src/migrations/2020_04_10_154637_create_citations_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 17 | $table->string('name'); 18 | $table->text('description'); 19 | $table->dateTime('date')->nullable(); 20 | $table->integer('is_active'); 21 | $table->integer('volume'); 22 | $table->integer('page'); 23 | $table->integer('confidence'); 24 | $table->integer('source_id')->references('id')->on('sources'); 25 | $table->timestamps(); 26 | }); 27 | } 28 | 29 | /** 30 | * Reverse the migrations. 31 | * 32 | * @return void 33 | */ 34 | public function down() 35 | { 36 | Schema::dropIfExists('citations'); 37 | } 38 | }; 39 | -------------------------------------------------------------------------------- /src/Models/FamilyEvent.php: -------------------------------------------------------------------------------- 1 | hasOne(Family::class, 'id', 'family_id'); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/migrations/2020_06_24_105140_create_person_lds_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string('group')->nullable(); 18 | $table->integer('gid')->nullable(); 19 | $table->string('type')->nullable(); 20 | $table->string('stat')->nullable(); 21 | $table->string('date')->nullable(); 22 | $table->string('plac')->nullable(); 23 | $table->string('temp')->nullable(); 24 | $table->string('slac_famc')->nullable(); 25 | $table->timestamps(); 26 | }); 27 | } 28 | 29 | /** 30 | * Reverse the migrations. 31 | * 32 | * @return void 33 | */ 34 | public function down() 35 | { 36 | Schema::dropIfExists('person_lds'); 37 | } 38 | }; 39 | -------------------------------------------------------------------------------- /src/Models/PersonEvent.php: -------------------------------------------------------------------------------- 1 | 'Birth', 37 | 'DEAT' => 'Death', 38 | ]; 39 | 40 | public static function boot() 41 | { 42 | parent::boot(); 43 | static::observe(new EventActionsObserver()); 44 | } 45 | 46 | public function person() 47 | { 48 | return $this->hasOne(Person::class, 'id', 'person_id'); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/factories/RepositoryFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->word(), 29 | 'addr_id' => Addr::factory(), 30 | 'rin' => $this->faker->word(), 31 | 'phon' => $this->faker->phoneNumber(), 32 | 'email' => $this->faker->email(), 33 | 'fax', 34 | 'www' => $this->faker->url(), 35 | 'name' => $this->faker->name(), 36 | 'description' => $this->faker->text(), 37 | 'type_id' => Type::factory(), 38 | 'is_active', 39 | ]; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/migrations/2020_06_01_112242_create_family_events_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 17 | $table->integer('family_id')->references('id')->on('families'); 18 | $table->integer('places_id')->references('id')->on('places')->nullable(); 19 | $table->text('date')->nullable(); 20 | $table->string('title')->nullable(); 21 | $table->text('description')->nullable(); 22 | $table->string('converted_date')->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_04_10_155019_create_notes_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 17 | $table->string('name')->nullable(); 18 | $table->text('description')->nullable(); 19 | $table->dateTime('date')->nullable(); 20 | $table->integer('type_id')->nullable(); 21 | $table->integer('is_active')->nullable(); 22 | $table->string('group')->nullable(); 23 | $table->string('gid')->nullable(); 24 | $table->longText('note')->nullable(); 25 | $table->string('rin')->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('notes'); 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /src/factories/SubmFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->word(), 28 | 'gid' => $this->faker->randomElement('1', '2'), 29 | 'name' => $this->faker->word(), 30 | 'addr_id' => Addr::factory(), 31 | 'rin' => $this->faker->word(), 32 | 'rfn' => $this->faker->word(), 33 | 'lang' => $this->faker->languageCode(), 34 | 'phon' => $this->faker->phoneNumber(), 35 | 'email' => $this->faker->email(), 'fax' => $this->faker->word(), 'www' => $this->faker->url(), 36 | 'created_at' => $this->faker->date(), 'updated_at', 37 | ]; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/migrations/2020_08_21_100421_create_personname_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string('group')->nullable(); 18 | $table->integer('gid')->nullable(); 19 | $table->string('name')->nullable(); 20 | $table->string('type')->nullable(); 21 | $table->string('npfx')->nullable(); 22 | $table->string('givn')->nullable(); 23 | $table->string('nick')->nullable(); 24 | $table->string('spfx')->nullable(); 25 | $table->string('surn')->nullable(); 26 | $table->string('nsfx')->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('personname'); 39 | } 40 | }; 41 | -------------------------------------------------------------------------------- /src/migrations/2020_08_21_110811_create_person_name_fone_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string('group')->nullable(); 18 | $table->integer('gid')->nullable(); 19 | $table->string('name')->nullable(); 20 | $table->string('type')->nullable(); 21 | $table->string('npfx')->nullable(); 22 | $table->string('givn')->nullable(); 23 | $table->string('nick')->nullable(); 24 | $table->string('spfx')->nullable(); 25 | $table->string('surn')->nullable(); 26 | $table->string('nsfx')->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('person_name_fone'); 39 | } 40 | }; 41 | -------------------------------------------------------------------------------- /src/migrations/2020_08_21_111106_create_person_name_romn_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string('group')->nullable(); 18 | $table->integer('gid')->nullable(); 19 | $table->string('name')->nullable(); 20 | $table->string('type')->nullable(); 21 | $table->string('npfx')->nullable(); 22 | $table->string('givn')->nullable(); 23 | $table->string('nick')->nullable(); 24 | $table->string('spfx')->nullable(); 25 | $table->string('surn')->nullable(); 26 | $table->string('nsfx')->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('person_name_romn'); 39 | } 40 | }; 41 | -------------------------------------------------------------------------------- /src/migrations/2020_06_12_190711_create_subm_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string('group')->nullable(); 18 | $table->integer('gid')->nullable(); 19 | $table->string('name')->nullable(); 20 | $table->integer('addr_id')->nullable(); 21 | $table->string('rin')->nullable(); 22 | $table->string('rfn')->nullable(); 23 | $table->string('lang')->nullable(); 24 | $table->string('phon')->nullable(); 25 | $table->string('email')->nullable(); 26 | $table->string('fax')->nullable(); 27 | $table->string('www')->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('subms'); 40 | } 41 | }; 42 | -------------------------------------------------------------------------------- /src/migrations/2020_06_11_173643_update_add_columns_people_table.php: -------------------------------------------------------------------------------- 1 | string('chan')->nullable(); 18 | $table->string('rin')->nullable(); 19 | $table->string('resn')->nullable(); 20 | $table->string('rfn')->nullable(); 21 | $table->string('afn')->nullable(); 22 | $table->string('deathday')->nullable()->after('birthday'); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | // 34 | Schema::table('people', function (Blueprint $table) { 35 | $table->dropColumn('chan'); 36 | $table->dropColumn('rin'); 37 | $table->dropColumn('resn'); 38 | $table->dropColumn('rfn'); 39 | $table->dropColumn('afn'); 40 | $table->dropColumn('deathday'); 41 | }); 42 | } 43 | }; 44 | -------------------------------------------------------------------------------- /src/Utils/Exporter/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 = app(MAddr::class)->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 = app(MAddr::class)->on($conn)->create(['adr1' => $adr1, 'adr2' => $adr2, 'city' => $city, 'stae' => $stae, 'post' => $post, 'ctry' => $ctry]); 40 | $id = $addr->id; 41 | } 42 | 43 | return $id; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /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 = app(MAddr::class)->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 = app(MAddr::class)->on($conn)->create(['adr1' => $adr1, 'adr2' => $adr2, 'city' => $city, 'stae' => $stae, 'post' => $post, 'ctry' => $ctry]); 40 | $id = $addr->id; 41 | } 42 | 43 | return $id; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Utils/Exporter/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 = app(Repository::class)->on($conn)->updateOrCreate($key, $data); 28 | 29 | $_group = 'reporef'; 30 | $_gid = $record->id; 31 | // store Note 32 | $notes = $reporef->getNote(); 33 | foreach ($notes as $item) { 34 | NoteRef::read($conn, $item, $_group, $_gid); 35 | } 36 | 37 | // store Caln 38 | $caln = $reporef->getCaln(); 39 | foreach ($caln as $item) { 40 | if ($item) { 41 | Caln::read($conn, $item, $_group, $_gid); 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /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 = app(Repository::class)->on($conn)->updateOrCreate($key, $data); 28 | 29 | $_group = 'reporef'; 30 | $_gid = $record->id; 31 | // store Note 32 | $notes = $reporef->getNote(); 33 | foreach ($notes as $item) { 34 | NoteRef::read($conn, $item, $_group, $_gid); 35 | } 36 | 37 | // store Caln 38 | $caln = $reporef->getCaln(); 39 | foreach ($caln as $item) { 40 | if ($item) { 41 | Caln::read($conn, $item, $_group, $_gid); 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /tests/Unit/FamilyParserTest.php: -------------------------------------------------------------------------------- 1 | mockDatabase(); 19 | $this->familyParser = new FamilyParser(DB::connection()); 20 | } 21 | 22 | private function mockDatabase() 23 | { 24 | DB::shouldReceive('beginTransaction')->andReturnSelf(); 25 | DB::shouldReceive('commit')->andReturnSelf(); 26 | DB::shouldReceive('rollBack')->andReturnSelf(); 27 | } 28 | 29 | public function testParseFamiliesWithValidData() 30 | { 31 | $families = [ 32 | (object)[ 33 | 'getId' => 'F1', 34 | 'getMarr' => (object)[ 35 | 'getDate' => '1990-01-01', 36 | 'getPlac' => 'Place1' 37 | ] 38 | ] 39 | ]; 40 | 41 | Family::shouldReceive('create')->once()->andReturn(new Family()); 42 | 43 | $result = $this->familyParser->parseFamilies($families); 44 | $this->assertTrue($result); 45 | } 46 | } 47 | 48 | -------------------------------------------------------------------------------- /src/Utils/Exporter/Indi/Asso.php: -------------------------------------------------------------------------------- 1 | getIndi(); 17 | $rela = $asso->getRela(); 18 | 19 | // store asso 20 | $key = ['group'=>$group, 'gid'=>$group_id, 'rela'=>$rela, 'indi' => $_indi]; 21 | $data = ['group'=>$group, 'gid'=>$group_id, 'rela'=>$rela, 'indi' => $_indi]; 22 | $record = app(PersonAsso::class)->on($conn)->updateOrCreate($key, $data); 23 | 24 | $_group = 'indi_asso'; 25 | $_gid = $record->id; 26 | // store Note 27 | $note = $asso->getNote(); 28 | foreach ($note as $item) { 29 | if ($item) { 30 | \FamilyTree365\LaravelGedcom\Utils\Importer\NoteRef::read($conn, $item, $_group, $_gid); 31 | } 32 | } 33 | 34 | // store sourref 35 | $sour = $asso->getSour(); 36 | foreach ($sour as $item) { 37 | if ($item) { 38 | \FamilyTree365\LaravelGedcom\Utils\Importer\SourRef::read($conn, $item, $_group, $_gid); 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Utils/Importer/Indi/Asso.php: -------------------------------------------------------------------------------- 1 | getIndi(); 17 | $rela = $asso->getRela(); 18 | 19 | // store asso 20 | $key = ['group'=>$group, 'gid'=>$group_id, 'rela'=>$rela, 'indi' => $_indi]; 21 | $data = ['group'=>$group, 'gid'=>$group_id, 'rela'=>$rela, 'indi' => $_indi]; 22 | $record = app(PersonAsso::class)->on($conn)->updateOrCreate($key, $data); 23 | 24 | $_group = 'indi_asso'; 25 | $_gid = $record->id; 26 | // store Note 27 | $note = $asso->getNote(); 28 | foreach ($note as $item) { 29 | if ($item) { 30 | \FamilyTree365\LaravelGedcom\Utils\Importer\NoteRef::read($conn, $item, $_group, $_gid); 31 | } 32 | } 33 | 34 | // store sourref 35 | $sour = $asso->getSour(); 36 | foreach ($sour as $item) { 37 | if ($item) { 38 | \FamilyTree365\LaravelGedcom\Utils\Importer\SourRef::read($conn, $item, $_group, $_gid); 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/migrations/2020_01_01_120000_create_default_people_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 13 | 14 | $table->tinyInteger('title')->nullable(); 15 | $table->string('name')->index(); 16 | $table->string('appellative')->index()->nullable(); 17 | 18 | $table->string('uid')->nullable()->unique(); 19 | $table->string('email')->unique()->nullable(); 20 | $table->string('phone')->nullable(); 21 | $table->string('birthday')->nullable(); 22 | 23 | $table->string('bank')->nullable(); 24 | $table->string('bank_account')->nullable(); 25 | 26 | $table->text('obs')->nullable(); 27 | 28 | $table->integer('created_by')->unsigned()->index()->nullable(); 29 | 30 | $table->integer('updated_by')->unsigned()->index()->nullable(); 31 | 32 | $table->timestamps(); 33 | }); 34 | } 35 | } 36 | 37 | public function down() 38 | { 39 | Schema::dropIfExists('people'); 40 | } 41 | }; 42 | -------------------------------------------------------------------------------- /src/Commands/GedcomImporter.php: -------------------------------------------------------------------------------- 1 | argument('filename'); 47 | GedcomParserFacade::parse('mysql', $filename, true, true); 48 | return 0; 49 | } 50 | } -------------------------------------------------------------------------------- /src/Utils/Exporter/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 = app(SourceData::class)->on($conn)->updateOrCreate($key, $_data); 26 | 27 | $_group = 'sourcedata'; 28 | $_gid = $record->id; 29 | // \Gedcom\Record\Sour\Data\Even array 30 | $even = $data->getEven(); 31 | foreach ($even as $item) { 32 | Even::read($conn, $item, $_group, $_gid); 33 | } 34 | // \Gedcom\Record\NoteRef array 35 | $note = $data->getNote(); 36 | foreach ($note as $item) { 37 | NoteRef::read($conn, $item, $_group, $_gid); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /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 = app(SourceData::class)->on($conn)->updateOrCreate($key, $_data); 26 | 27 | $_group = 'sourcedata'; 28 | $_gid = $record->id; 29 | // \Gedcom\Record\Sour\Data\Even array 30 | $even = $data->getEven(); 31 | foreach ($even as $item) { 32 | Even::read($conn, $item, $_group, $_gid); 33 | } 34 | // \Gedcom\Record\NoteRef array 35 | $note = $data->getNote(); 36 | foreach ($note as $item) { 37 | NoteRef::read($conn, $item, $_group, $_gid); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/migrations/2020_04_10_155307_create_repositories_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 17 | $table->string('group')->nullable(); 18 | $table->integer('gid')->nullable(); 19 | $table->string('name')->nullable(); 20 | $table->text('description')->nullable(); 21 | $table->dateTime('date')->nullable(); 22 | $table->integer('is_active')->nullable(); 23 | $table->integer('type_id')->nullable(); 24 | $table->string('repo')->nullable(); 25 | $table->integer('addr_id')->nullable(); 26 | $table->string('rin')->nullable(); 27 | $table->string('phon')->nullable(); 28 | $table->string('email')->nullable(); 29 | $table->string('fax')->nullable(); 30 | $table->string('www')->nullable(); 31 | $table->timestamps(); 32 | }); 33 | } 34 | 35 | /** 36 | * Reverse the migrations. 37 | * 38 | * @return void 39 | */ 40 | public function down() 41 | { 42 | Schema::dropIfExists('repositories'); 43 | } 44 | }; 45 | -------------------------------------------------------------------------------- /src/Utils/Exporter/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 | app(PersonNameRomn::class)->on($conn)->updateOrCreate($key, $data); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /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 | app(PersonNameRomn::class)->on($conn)->updateOrCreate($key, $data); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/factories/FamilyEventFactory.php: -------------------------------------------------------------------------------- 1 | Family::factory(), 29 | 'places_id' => Place::factory(), 30 | 'date' => $this->faker->date(), 31 | 'title' => $this->faker->word(), 32 | 'description' => $this->faker->text(), 33 | 'year' => $this->faker->year(), 34 | 'month' => $this->faker->month(), 35 | 'day' => $this->faker->dayOfMonth(), 36 | 'type' => $this->faker->word(), 37 | 'plac' => $this->faker->word(), 38 | 'phon' => $this->faker->phoneNumber(), 39 | 'caus' => $this->faker->word(), 40 | 'age' => $this->faker->numberBetween(10, 79), 41 | 'husb' => $this->faker->word(), 42 | 'wife' => $this->faker->word(), 43 | ]; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/factories/PersonEventFactory.php: -------------------------------------------------------------------------------- 1 | Person::factory(), 29 | 'title' => $this->faker->jobTitle(), 30 | 'type' => $this->faker->jobTitle(), 31 | 'attr' => $this->faker->text(), 32 | 'date' => $this->faker->date(), 33 | 'plac' => $this->faker->address(), 34 | 'phon' => $this->faker->phoneNumber(), 35 | 'caus' => $this->faker->text(), 36 | 'age' => $this->faker->randomNumber(50), 37 | 'agnc' => $this->faker->word(), 38 | 'places_id' => Place::factory(), 39 | 'description' => $this->faker->text(), 40 | 'year' => $this->faker->year(), 41 | 'month' => $this->faker->month(), 42 | 'day' => $this->faker->dayOfMonth(), 43 | ]; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Utils/Exporter/ObjeRef.php: -------------------------------------------------------------------------------- 1 | getObje(); 21 | if (isset($obje_ids[$obje_id])) { 22 | $obje_id = $obje_ids[$obje_id]; 23 | } 24 | $titl = $objeref->getTitl(); 25 | $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 = app(MediaObject::class)->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.php: -------------------------------------------------------------------------------- 1 | getObje(); 21 | if (isset($obje_ids[$obje_id])) { 22 | $obje_id = $obje_ids[$obje_id]; 23 | } 24 | $titl = $objeref->getTitl(); 25 | $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 = app(MediaObject::class)->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 | -------------------------------------------------------------------------------- /sweep.yaml: -------------------------------------------------------------------------------- 1 | # Sweep AI turns bugs & feature requests into code changes (https://sweep.dev) 2 | # For details on our config file, check out our docs at https://docs.sweep.dev/usage/config 3 | 4 | # This setting contains a list of rules that Sweep will check for. If any of these rules are broken in a new commit, Sweep will create an pull request to fix the broken rule. 5 | rules: 6 | - "All new business logic should have corresponding unit tests." 7 | - "Refactor large functions to be more modular." 8 | - "Add docstrings to all functions and file headers." 9 | 10 | # This is the branch that Sweep will develop from and make pull requests to. Most people use 'main' or 'master' but some users also use 'dev' or 'staging'. 11 | branch: 'main' 12 | 13 | # By default Sweep will read the logs and outputs from your existing Github Actions. To disable this, set this to false. 14 | gha_enabled: True 15 | 16 | # This is the description of your project. It will be used by sweep when creating PRs. You can tell Sweep what's unique about your project, what frameworks you use, or anything else you want. 17 | # 18 | # Example: 19 | # 20 | # description: sweepai/sweep is a python project. The main api endpoints are in sweepai/api.py. Write code that adheres to PEP8. 21 | description: '' 22 | 23 | # This sets whether to create pull requests as drafts. If this is set to True, then all pull requests will be created as drafts and GitHub Actions will not be triggered. 24 | draft: False 25 | 26 | # This is a list of directories that Sweep will not be able to edit. 27 | blocked_dirs: [] 28 | -------------------------------------------------------------------------------- /src/Utils/GedcomExporter.php: -------------------------------------------------------------------------------- 1 | query(); 24 | $query->join('addrs', 'addrs.id', '=', 'subms.addr_id'); 25 | $query->select([ 26 | 'subms.name', 27 | 'addrs.adr1', 28 | 'addrs.adr2', 29 | 'addrs.city', 30 | 'addrs.stae', 31 | 'addrs.post', 32 | 'addrs.ctry', 33 | 'subms.phon', 34 | ]); 35 | 36 | $people = app(Person::class)->all(); 37 | $submissions = $query->get(); 38 | 39 | $data = [ 40 | 'submissions' => $submissions, 41 | 'people' => $people, 42 | ]; 43 | 44 | $source = View::make('stubs.ged', $data)->render(); 45 | 46 | $ged_doc = "HEAD \nGEDC \nVERS 5.5.5 \nFORM LINEAGE-LINKED \nVERS 5.5.5 \nCHAR UTF-8 \nSOUR GS \nVERS 5.5.5 \nCORP gedcom.org\n"; 47 | 48 | $handle = fopen($filename, 'w'); 49 | 50 | fwrite($handle, $ged_doc . $source); 51 | 52 | fclose($handle); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/Events/GedComProgressSent.php: -------------------------------------------------------------------------------- 1 | 'gedcom-progress', 'eventName' => 'newMessage']) 29 | { 30 | } 31 | 32 | /** 33 | * Get the data to broadcast. 34 | * 35 | * @return array 36 | */ 37 | public function broadcastWith() 38 | { 39 | return [ 40 | 'slug' => $this->slug, 41 | 'total' => $this->total, 42 | 'complete' => $this->complete, 43 | ]; 44 | } 45 | 46 | /** 47 | * Get the channels the event should broadcast on. 48 | * 49 | * @return Channel|array 50 | */ 51 | public function broadcastOn() 52 | { 53 | return new Channel($this->channel['name']); 54 | } 55 | 56 | public function broadcastAs() 57 | { 58 | return $this->channel['eventName']; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/Utils/Exporter/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 | app(PersonNameFone::class)->on($conn)->updateOrCreate($key, $data); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /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 | app(PersonNameFone::class)->on($conn)->updateOrCreate($key, $data); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/migrations/2021_08_26_222539_add_column_dati_plac_famc_fams_to_people_table.php: -------------------------------------------------------------------------------- 1 | string('birthday_dati')->nullable(); 17 | $table->string('birthday_plac')->nullable(); 18 | $table->string('deathday_dati')->nullable(); 19 | $table->string('deathday_plac')->nullable(); 20 | $table->string('deathday_caus')->nullable(); 21 | $table->string('burial_day_dati')->nullable(); 22 | $table->string('burial_day_plac')->nullable(); 23 | $table->string('famc')->nullable(); 24 | $table->string('fams')->nullable(); 25 | }); 26 | } 27 | 28 | /** 29 | * Reverse the migrations. 30 | * 31 | * @return void 32 | */ 33 | public function down() 34 | { 35 | Schema::table('people', function (Blueprint $table) { 36 | $table->dropColumn([ 37 | 'birthday_dati', 38 | 'birthday_plac', 39 | 'deathday_dati', 40 | 'deathday_plac', 41 | 'deathday_caus', 42 | 'burial_day_dati', 43 | 'burial_day_plac', 44 | 'famc', 45 | 'fams', 46 | ]); 47 | }); 48 | } 49 | }; 50 | -------------------------------------------------------------------------------- /src/ServiceProvider.php: -------------------------------------------------------------------------------- 1 | app->runningInConsole()) { 20 | $this->commands([ 21 | \FamilyTree365\LaravelGedcom\Commands\GedcomImporter::class, 22 | \FamilyTree365\LaravelGedcom\Commands\GedcomExporter::class, 23 | \FamilyTree365\LaravelGedcom\Commands\GedcomXImporter::class, 24 | \FamilyTree365\LaravelGedcom\Commands\GedcomXImporterOptimized::class, 25 | ]); 26 | } 27 | 28 | $this->loadMigrationsFrom(__DIR__.'/migrations'); 29 | } 30 | 31 | /** 32 | * Register the application services. 33 | * 34 | * @return void 35 | */ 36 | public function register() 37 | { 38 | // Register the GedcomParser singleton 39 | $this->app->singleton('gedcom-parser', function ($app) { 40 | return new GedcomParser(); 41 | }); 42 | 43 | // Register the GedcomXParser singleton 44 | $this->app->singleton('gedcomx-parser', function ($app) { 45 | return new GedcomXParser(); 46 | }); 47 | 48 | // Register the facades 49 | $this->app->alias('gedcom-parser', 'GedcomParser'); 50 | $this->app->alias('gedcomx-parser', 'GedcomXParser'); 51 | } 52 | } -------------------------------------------------------------------------------- /src/Utils/Exporter/Note.php: -------------------------------------------------------------------------------- 1 | getNote(); 19 | $rin = $note->getRin(); 20 | 21 | // store note 22 | $key = ['group'=>$group, 'gid'=>$group_id, 'note'=> mb_convert_encoding((string) $_note, 'UTF-8', 'ISO-8859-1')]; 23 | $data = ['group'=>$group, 'gid'=>$group_id, 'note'=> mb_convert_encoding((string) $_note, 'UTF-8', 'ISO-8859-1'), 'rin'=>$rin]; 24 | $record = app(MNote::class)->on($conn)->updateOrCreate($key, $data); 25 | 26 | // store Sources of Note 27 | $_group = 'note'; 28 | $_gid = $record->id; 29 | // SourRef array 30 | $sour = $note->getSour(); 31 | foreach ($sour as $item) { 32 | SourRef::read($conn, $item, $_group, $_gid); 33 | } 34 | // Refn array 35 | $refn = $note->getRefn(); 36 | foreach ($refn as $item) { 37 | Refn::read($conn, $item, $_group, $_gid); 38 | } 39 | 40 | // Chan 41 | $chan = $note->getChan(); 42 | if ($chan !== null) { 43 | Chan::read($conn, $chan, $_group, $_gid); 44 | } 45 | 46 | return $_gid; 47 | } catch (Throwable $e) { 48 | report($e); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/Utils/Importer/Note.php: -------------------------------------------------------------------------------- 1 | getNote(); 19 | $rin = $note->getRin(); 20 | 21 | // store note 22 | $key = ['group'=>$group, 'gid'=>$group_id, 'note'=> mb_convert_encoding((string) $_note, 'UTF-8', 'ISO-8859-1')]; 23 | $data = ['group'=>$group, 'gid'=>$group_id, 'note'=> mb_convert_encoding((string) $_note, 'UTF-8', 'ISO-8859-1'), 'rin'=>$rin]; 24 | $record = app(MNote::class)->on($conn)->updateOrCreate($key, $data); 25 | 26 | // store Sources of Note 27 | $_group = 'note'; 28 | $_gid = $record->id; 29 | // SourRef array 30 | $sour = $note->getSour(); 31 | foreach ($sour as $item) { 32 | SourRef::read($conn, $item, $_group, $_gid); 33 | } 34 | // Refn array 35 | $refn = $note->getRefn(); 36 | foreach ($refn as $item) { 37 | Refn::read($conn, $item, $_group, $_gid); 38 | } 39 | 40 | // Chan 41 | $chan = $note->getChan(); 42 | if ($chan !== null) { 43 | Chan::read($conn, $chan, $_group, $_gid); 44 | } 45 | 46 | return $_gid; 47 | } catch (Throwable $e) { 48 | report($e); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/Utils/Exporter/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 = app(MSubn::class)->on($conn)->updateOrCreate(['subm' => $subm, 'famf' => $famf, 'temp' => $temp, 'ance' => $ance, 'desc' => $desc, 'ordi' => $ordi, 'rin' => $rin], ['subm' => $subm, 'famf' => $famf, 'temp' => $temp, 'ance' => $ance, 'desc' => $desc, 'ordi' => $ordi, 'rin' => $rin]); 31 | 32 | $_group = 'subn'; 33 | $_gid = $record->id; 34 | 35 | $note = $subn->getNote(); // array --- 36 | 37 | if ($note != null && (is_countable($note) ? count($note) : 0) > 0) { 38 | foreach ($note as $item) { 39 | \FamilyTree365\LaravelGedcom\Utils\Importer\NoteRef::read($conn, $item, $_group, $_gid); 40 | } 41 | } 42 | $chan = $subn->getChan() ?? null; // Record\Chan--- 43 | if ($chan !== null) { 44 | \FamilyTree365\LaravelGedcom\Utils\Importer\Chan::read($conn, $chan, $_group, $_gid); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /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 = app(MSubn::class)->on($conn)->updateOrCreate(['subm' => $subm, 'famf' => $famf, 'temp' => $temp, 'ance' => $ance, 'desc' => $desc, 'ordi' => $ordi, 'rin' => $rin], ['subm' => $subm, 'famf' => $famf, 'temp' => $temp, 'ance' => $ance, 'desc' => $desc, 'ordi' => $ordi, 'rin' => $rin]); 31 | 32 | $_group = 'subn'; 33 | $_gid = $record->id; 34 | 35 | $note = $subn->getNote(); // array --- 36 | 37 | if ($note != null && (is_countable($note) ? count($note) : 0) > 0) { 38 | foreach ($note as $item) { 39 | \FamilyTree365\LaravelGedcom\Utils\Importer\NoteRef::read($conn, $item, $_group, $_gid); 40 | } 41 | } 42 | $chan = $subn->getChan() ?? null; // Record\Chan--- 43 | if ($chan !== null) { 44 | \FamilyTree365\LaravelGedcom\Utils\Importer\Chan::read($conn, $chan, $_group, $_gid); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/factories/SourceFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->word(), 31 | 'titl' => $this->faker->word(), 32 | 'auth', 33 | 'data' => $this->faker->word(), 34 | 'text' => $this->faker->word(), 35 | 'publ' => $this->faker->text(), 36 | 'abbr' => $this->faker->word(), 37 | 'name' => $this->faker->word(), 38 | 'description' => $this->faker->word(), 39 | 'repository_id' => Repository::factory(), 40 | 'author_id' => Author::factory(), 41 | 'publication_id' => Publication::factory(), 42 | 'type_id' => Type::factory(), 43 | 'is_active', 'group' => $this->faker->word(), 44 | 'gid' => $this->faker->word(), 45 | 'quay' => $this->faker->word(), 46 | 'page' => $this->faker->word(), 47 | ]; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Utils/Exporter/Sour/Repo.php: -------------------------------------------------------------------------------- 1 | getRepo(); 18 | if (empty($repo_id)) { 19 | $repo_id = random_int(1, 10000); 20 | } 21 | $_caln = $data->getCaln(); 22 | $caln = ''; 23 | if ($_caln != null && (is_countable($_caln) ? count($_caln) : 0) > 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 = app(SourceRepo::class)->on($conn)->updateOrCreate($key, $_data); 40 | 41 | $_group = 'sourcerepo'; 42 | $_gid = $record->id; 43 | 44 | // \Gedcom\Record\NoteRef array 45 | $note = $data->getNote(); 46 | foreach ($note as $item) { 47 | NoteRef::read($conn, $item, $_group, $_gid); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Utils/Importer/Sour/Repo.php: -------------------------------------------------------------------------------- 1 | getRepo(); 18 | if (empty($repo_id)) { 19 | $repo_id = random_int(1, 10000); 20 | } 21 | $_caln = $data->getCaln(); 22 | $caln = ''; 23 | if ($_caln != null && (is_countable($_caln) ? count($_caln) : 0) > 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 = app(SourceRepo::class)->on($conn)->updateOrCreate($key, $_data); 40 | 41 | $_group = 'sourcerepo'; 42 | $_gid = $record->id; 43 | 44 | // \Gedcom\Record\NoteRef array 45 | $note = $data->getNote(); 46 | foreach ($note as $item) { 47 | NoteRef::read($conn, $item, $_group, $_gid); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tests/Unit/IndividualParserTest.php: -------------------------------------------------------------------------------- 1 | mockDatabase(); 23 | $this->individualParser = new IndividualParser(DB::connection()); 24 | } 25 | 26 | private function mockDatabase() 27 | { 28 | DB::shouldReceive('beginTransaction')->andReturnSelf(); 29 | DB::shouldReceive('commit')->andReturnSelf(); 30 | DB::shouldReceive('rollBack')->andReturnSelf(); 31 | Log::shouldReceive('error')->andReturnNull(); 32 | } 33 | 34 | public function testParseIndividualsWithValidData() 35 | { 36 | $individuals = [ 37 | (object)[ 38 | 'getId' => 'I1', 39 | 'getName' => (object)['getFullName' => 'John Doe'], 40 | 'getSex' => 'M', 41 | 'getBirth' => (object)['getDate' => '1980-01-01'], 42 | 'getDeath' => (object)['getDate' => '2050-01-01'] 43 | ] 44 | ]; 45 | 46 | Person::shouldReceive('create')->once()->andReturn(new Person()); 47 | 48 | $result = $this->individualParser->parseIndividuals($individuals); 49 | $this->assertTrue($result); 50 | } 51 | 52 | public function tearDown(): void 53 | { 54 | Mockery::close(); 55 | parent::tearDown(); 56 | } 57 | } 58 | 59 | -------------------------------------------------------------------------------- /src/migrations/2020_06_01_112223_create_persons_events_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string('converted_date')->nullable(); 18 | $table->unsignedBigInteger('person_id')->nullable(); 19 | $table->string('title')->nullable(); 20 | $table->string('date')->nullable(); 21 | $table->string('description')->nullable(); 22 | $table->unsignedBigInteger('places_id')->nullable(); 23 | $table->integer('year')->nullable(); 24 | $table->integer('month')->nullable(); 25 | $table->integer('day')->nullable(); 26 | $table->string('type')->nullable(); 27 | $table->string('attr')->nullable(); 28 | $table->string('plac')->nullable(); 29 | $table->integer('addr_id')->nullable(); 30 | $table->string('phon')->nullable(); 31 | $table->text('caus')->nullable(); 32 | $table->string('age')->nullable(); 33 | $table->string('agnc')->nullable(); 34 | $table->string('adop')->nullable(); 35 | $table->string('adop_famc')->nullable(); 36 | $table->string('birt_famc')->nullable(); 37 | $table->timestamps(); 38 | $table->softDeletes(); 39 | }); 40 | } 41 | 42 | /** 43 | * Reverse the migrations. 44 | * 45 | * @return void 46 | */ 47 | public function down() 48 | { 49 | Schema::dropIfExists('person_events'); 50 | } 51 | }; 52 | -------------------------------------------------------------------------------- /src/migrations/2020_04_10_155413_create_sources_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 17 | $table->string('name')->nullable(); 18 | $table->text('description')->nullable(); 19 | $table->string('date')->nullable(); 20 | $table->integer('is_active')->nullable(); 21 | $table->integer('author_id')->nullable(); 22 | $table->integer('repository_id')->references('id')->on('repositories')->nullable(); 23 | $table->integer('publication_id')->nullable(); 24 | $table->integer('type_id')->nullable(); 25 | $table->string('sour')->nullable(); 26 | $table->text('titl')->nullable(); 27 | $table->string('auth')->nullable(); 28 | $table->string('data')->nullable(); 29 | $table->text('text')->nullable(); 30 | $table->text('publ')->nullable(); 31 | $table->string('abbr')->nullable(); 32 | $table->string('group')->nullable(); 33 | $table->integer('gid')->nullable(); 34 | $table->string('quay')->nullable(); 35 | $table->text('page')->nullable(); 36 | $table->string('rin')->nullable(); 37 | $table->string('note')->nullable(); 38 | $table->timestamps(); 39 | }); 40 | } 41 | 42 | /** 43 | * Reverse the migrations. 44 | * 45 | * @return void 46 | */ 47 | public function down() 48 | { 49 | Schema::dropIfExists('sources'); 50 | } 51 | }; 52 | -------------------------------------------------------------------------------- /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('plac')->nullable(); 22 | $table->integer('addr_id')->nullable(); 23 | $table->string('phon')->nullable(); 24 | $table->text('caus')->nullable(); 25 | $table->string('age')->nullable(); 26 | $table->string('agnc')->nullable(); 27 | $table->integer('husb')->nullable(); 28 | $table->integer('wife')->nullable(); 29 | }); 30 | } 31 | 32 | /** 33 | * Reverse the migrations. 34 | * 35 | * @return void 36 | */ 37 | public function down() 38 | { 39 | 40 | Schema::table('family_events', function (Blueprint $table) { 41 | $table->dropColumn('year'); 42 | $table->dropColumn('month'); 43 | $table->dropColumn('day'); 44 | $table->dropColumn('type'); 45 | $table->dropColumn('plac'); 46 | $table->dropColumn('addr_id'); 47 | $table->dropColumn('phon'); 48 | $table->dropColumn('caus'); 49 | $table->dropColumn('age'); 50 | $table->dropColumn('agnc'); 51 | $table->dropColumn('husb'); 52 | $table->dropColumn('wife'); 53 | }); 54 | } 55 | }; 56 | -------------------------------------------------------------------------------- /src/migrations/2020_06_03_192100_add_columns_for_people_table.php: -------------------------------------------------------------------------------- 1 | string('gid')->nullable(); 12 | $table->string('givn')->nullable(); 13 | $table->string('surn', 191)->nullable(); 14 | $table->string('name', 191)->nullable()->change(); 15 | 16 | $table->string('type')->nullable(); 17 | $table->string('npfx')->nullable(); 18 | $table->string('nick')->nullable(); 19 | $table->string('spfx')->nullable(); 20 | $table->string('nsfx')->nullable(); 21 | 22 | $table->char('sex', 1)->nullable(); 23 | $table->text('description')->nullable(); 24 | $table->integer('child_in_family_id')->references('id')->on('families')->nullable(); 25 | $table->softDeletes(); 26 | // $table->dropColumn('bank'); 27 | // $table->dropColumn('bank_account'); 28 | $table->dropUnique(['uid']); 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 | -------------------------------------------------------------------------------- /tests/Unit/ProgressReporterTest.php: -------------------------------------------------------------------------------- 1 | 'test-channel', 'eventName' => 'testEvent']; 22 | $progressReporter = new ProgressReporter($totalSteps, $channel); 23 | 24 | $this->assertEquals($totalSteps, $progressReporter->totalSteps); 25 | $this->assertEquals($channel, $progressReporter->channel); 26 | } 27 | 28 | public function testAdvanceProgress() 29 | { 30 | $totalSteps = 5; 31 | $channel = ['name' => 'progress-channel', 'eventName' => 'progressEvent']; 32 | $progressReporter = new ProgressReporter($totalSteps, $channel); 33 | 34 | $progressReporter->advanceProgress(1); 35 | 36 | Event::assertDispatched(GedComProgressSent::class, function ($event) use ($channel) { 37 | return $event->channel === $channel && $event->currentProgress === 1; 38 | }); 39 | } 40 | 41 | public function testCompleteProgress() 42 | { 43 | $totalSteps = 3; 44 | $channel = ['name' => 'complete-channel', 'eventName' => 'completeEvent']; 45 | $progressReporter = new ProgressReporter($totalSteps, $channel); 46 | 47 | $progressReporter->completeProgress(); 48 | 49 | Event::assertDispatched(GedComProgressSent::class, function ($event) use ($totalSteps, $channel) { 50 | return $event->channel === $channel && $event->currentProgress === $totalSteps; 51 | }); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/Utils/Importer/Fam/Slgs.php: -------------------------------------------------------------------------------- 1 | getStat(); 25 | $date = $slgs->getDate(); 26 | $plac = $slgs->getPlac(); 27 | $temp = $slgs->getTemp(); 28 | 29 | $key = [ 30 | 'family_id'=> $fam->id, 31 | 'stat' => $stat, 32 | 'date' => $date, 33 | 'plac' => $plac, 34 | 'temp' => $temp, 35 | ]; 36 | $data = [ 37 | 'family_id'=> $fam->id, 38 | 'stat' => $stat, 39 | 'date' => $date, 40 | 'plac' => $plac, 41 | 'temp' => $temp, 42 | ]; 43 | 44 | $record = app(FamilySlgs::class)->on($conn)->updateOrCreate($key, $data); 45 | 46 | $_group = 'fam_slgs'; 47 | $_gid = $record->id; 48 | 49 | // array 50 | $sour = $slgs->getSour(); 51 | foreach ($sour as $item) { 52 | if ($item) { 53 | \FamilyTree365\LaravelGedcom\Utils\Importer\SourRef::read($conn, $item, $_group, $_gid); 54 | } 55 | } 56 | 57 | $note = $slgs->getNote(); 58 | foreach ($note as $item) { 59 | \FamilyTree365\LaravelGedcom\Utils\Importer\NoteRef::read($conn, $item, $_group, $_gid); 60 | } 61 | } catch (Throwable $e) { 62 | report($e); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/Utils/Exporter/Fam/Slgs.php: -------------------------------------------------------------------------------- 1 | getStat(); 25 | $date = $slgs->getDate(); 26 | $plac = $slgs->getPlac(); 27 | $temp = $slgs->getTemp(); 28 | 29 | $key = [ 30 | 'family_id'=> $fam->id, 31 | 'stat' => $stat, 32 | 'date' => $date, 33 | 'plac' => $plac, 34 | 'temp' => $temp, 35 | ]; 36 | $data = [ 37 | 'family_id'=> $fam->id, 38 | 'stat' => $stat, 39 | 'date' => $date, 40 | 'plac' => $plac, 41 | 'temp' => $temp, 42 | ]; 43 | 44 | $record = app(FamilySlgs::class)->on($conn)->updateOrCreate($key, $data); 45 | 46 | $_group = 'fam_slgs'; 47 | $_gid = $record->id; 48 | 49 | // array 50 | $sour = $slgs->getSour(); 51 | foreach ($sour as $item) { 52 | if ($item) { 53 | \FamilyTree365\LaravelGedcom\Utils\Importer\SourRef::read($conn, $item, $_group, $_gid); 54 | } 55 | } 56 | 57 | $note = $slgs->getNote(); 58 | foreach ($note as $item) { 59 | \FamilyTree365\LaravelGedcom\Utils\Importer\NoteRef::read($conn, $item, $_group, $_gid); 60 | } 61 | } catch (Throwable $e) { 62 | report($e); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/Utils/Exporter/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 = app(MediaObject::class)->on($conn)->updateOrCreate($key, $data); 38 | 39 | $_group = 'obje'; 40 | $_gid = $record->id; 41 | 42 | $refn = $obje->getRefn(); // Record/Refn array 43 | foreach ($refn as $item) { 44 | Refn::read($conn, $item, $_group, $_gid); 45 | } 46 | 47 | // store Note 48 | $note = $obje->getNote(); // Record/NoteRef array 49 | foreach ($note as $item) { 50 | NoteRef::read($conn, $item, $_group, $_gid); 51 | } 52 | 53 | // store Note 54 | $files = $obje->getFile(); // Record/NoteRef array 55 | if (($files && count((is_countable($files) ? $files : [])))) { 56 | foreach ($files as $item) { 57 | \FamilyTree365\LaravelGedcom\Utils\Importer\ObjeRef\File::read($conn, $item, $_group, $_gid); 58 | } 59 | } 60 | 61 | $chan = $obje->getChan(); // Recore/Chan 62 | if ($chan !== null) { 63 | \FamilyTree365\LaravelGedcom\Utils\Importer\Chan::read($conn, $chan, $_group, $_gid); 64 | } 65 | 66 | return $_gid; 67 | } 68 | } 69 | --------------------------------------------------------------------------------