WordPress web design and development

Starting a family history app using Laravel

So I’ve finally decided to jump on the Laravel bandwagon for developing an app for family historians. In a nutshell, I want something where I can put data in, and it would get exported in a readable format where I could put in a book for future generations.

I originally considered using WordPress since I’m so familiar with it, but decided not to for several reasons. Plus I’ve been looking for an excuse to use Laravel anyway, but I don’t want to waste time building a blog (I can do that with WordPress) or creating a todo app (already got Apple Reminders).

Lots o’ Laravel mistakes ahead

I started watching Jeffery Way’s Laravel from Scratch course where he guides you how to develop a blog using Laravel. Right I’ve been following along, but developing an app for family history, starting with people instead of blog posts.

And that’s where I made my first mistake, when attempting to create a migration file:

php artisan make:migration create_persons_table
php artisan make:model Person

I used the plural ‘persons’ for the table with singular ‘person’ for the model. I then ran artisan migrate. Everything seemed fine until I was using tinker to try to create a Person and save it to the database:

$person = new Person;
$person->family_name = ‘Picard’;
$person->given_name = ‘Jean Luc’;

Instead of seeing true, I saw this:

Illuminate\Database\QueryException: Base table or view not found. Table ‘database.people’ doesn’t exist…

I then thought, “Wait, it’s looking for ‘people’ when I specifically said ‘persons’. Now there is a way to override Laravel’s handling of pluralization, but I’m fine with using their default settings. So I had to rollback the migration, delete it, create a new migration this time calling it create_people_table.

The migration schema includes:

public function up() {
  Schema::create('people', function (Blueprint $table) {

For the schema, I’m just starting with first name, last name, birthdate and death date, roughly following the naming convention used for HTML autocomplete attributes.

Problems with dates

There’s an issue with the current schema as far as date handling goes. I have the scheme configured where the birthdate and death date are either fixed date (with time) or they are null.

Most genealogy software allows you to approximate an event’s date to a month or year, or even say before or after a fixed date. I’m not sure how I’ll resolve this but that’s part of the journey.