Skip to content

Instantly share code, notes, and snippets.

@joetannenbaum
Last active January 30, 2017 16:36
Show Gist options
  • Save joetannenbaum/1e437673cf9c08ff601de65f1d6a21d4 to your computer and use it in GitHub Desktop.
Save joetannenbaum/1e437673cf9c08ff601de65f1d6a21d4 to your computer and use it in GitHub Desktop.
create history table
<?php
class CreateHistoryTable extends Migration
{
public function up()
{
Schema::create('history', function (Blueprint $table) {
$table->increments('id');
// Which table are we tracking
$table->string('reference_table');
// Which record from the table are we referencing
$table->integer('reference_id')->unsigned();
// Who made the action
$table->integer('actor_id')->unsigned();
// What did they do
$table->string('body');
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('history');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment