Last active
August 29, 2015 14:06
-
-
Save ollieread/386f063f1d4b41c6c7f1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Activity | |
{ | |
public static function log(Model $user, Model $subject, $action) | |
{ | |
$log = $this->user->logs()-.>create(['action'] => $action]); | |
$log->subject()->save($subject); | |
} | |
} |
This file contains hidden or 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 create_logging_table extends Migration | |
{ | |
public function up() | |
{ | |
Schema::create('activity_logging', function(Blueprint $table) | |
{ | |
$table->increments('id'); | |
$table->integer('user_id', false); | |
$table->morphs('subject'); | |
$table->string('action'); | |
$table->timestamps(); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment