Last active
January 30, 2017 16:36
-
-
Save joetannenbaum/1e437673cf9c08ff601de65f1d6a21d4 to your computer and use it in GitHub Desktop.
create history table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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