浏览代码

Add Activity Model/Migration

Daniel Supernault 6 年之前
父节点
当前提交
a8b6002c0b
共有 2 个文件被更改,包括 46 次插入0 次删除
  1. 10 0
      app/Activity.php
  2. 36 0
      database/migrations/2018_09_11_202435_create_activities_table.php

+ 10 - 0
app/Activity.php

@@ -0,0 +1,10 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class Activity extends Model
+{
+    protected $dates = ['processed_at'];
+}

+ 36 - 0
database/migrations/2018_09_11_202435_create_activities_table.php

@@ -0,0 +1,36 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateActivitiesTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('activities', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->bigInteger('to_id')->unsigned()->nullable();
+            $table->bigInteger('from_id')->unsigned()->nullable();
+            $table->string('object_type')->nullable();
+            $table->json('data')->nullable();
+            $table->timestamp('processed_at')->nullable();
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('activities');
+    }
+}