Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lucassmacedo/e6528571a356eeaa358dc07c8e97d19c to your computer and use it in GitHub Desktop.
Save lucassmacedo/e6528571a356eeaa358dc07c8e97d19c to your computer and use it in GitHub Desktop.
Schema::create('person_types', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('slug')->nullable();
$table->timestamps();
});
ex: Figurinista, Diretor, Ator, etc
Schema::create('people', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('slug')->nullable();
$table->string('site')->nullable();
$table->date('birth')->nullable();
$table->enum('sex', ['Masculino', 'Feminino']);
$table->timestamps();
});
Schema::create('person_person_type', function($table)
{
$table->integer('person_id')->unsigned();
$table->foreign('person_id')->references('id')->on('people');
$table->integer('person_type_id')->unsigned();
$table->foreign('person_type_id')->references('id')->on('person_types');
$table->timestamps();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment