* @author Quetzy Garcia * @author Raphael França * @copyright 2015-2017 * * For the full copyright and license information, * please view the LICENSE.md file that was distributed * with this source code. */ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\Schema; class CreateAuditsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::connection(Config::get('audit.drivers.database.connection')) ->create(Config::get('audit.drivers.database.table'), function (Blueprint $table) { $table->increments('id'); $table->unsignedInteger(Config::get('audit.user.foreign_key', 'user_id'))->nullable(); $table->string('event'); $table->morphs('auditable'); $table->text('old_values')->nullable(); $table->text('new_values')->nullable(); $table->text('url')->nullable(); $table->ipAddress('ip_address')->nullable(); $table->string('user_agent')->nullable(); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::connection(Config::get('audit.drivers.database.connection')) ->drop(Config::get('audit.drivers.database.table')); } }