Преглед на файлове

Add Report model/migration/controller

Daniel Supernault преди 7 години
родител
ревизия
31a238e925
променени са 3 файла, в които са добавени 93 реда и са изтрити 0 реда
  1. 38 0
      app/Http/Controllers/ReportController.php
  2. 10 0
      app/Report.php
  3. 45 0
      database/migrations/2018_05_04_054007_create_reports_table.php

+ 38 - 0
app/Http/Controllers/ReportController.php

@@ -0,0 +1,38 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use Illuminate\Http\Request;
+
+class ReportController extends Controller
+{
+    public function showForm(Request $request)
+    {
+      return view('report.form');
+    }
+
+    public function notInterestedForm(Request $request)
+    {
+      return view('report.not-interested');
+    }
+
+    public function spamForm(Request $request)
+    {
+      return view('report.spam');
+    }
+
+    public function spamCommentForm(Request $request)
+    {
+      return view('report.spam.comment');
+    }
+
+    public function spamPostForm(Request $request)
+    {
+      return view('report.spam.post');
+    }
+
+    public function spamProfileForm(Request $request)
+    {
+      return view('report.spam.profile');
+    }
+}

+ 10 - 0
app/Report.php

@@ -0,0 +1,10 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class Report extends Model
+{
+    //
+}

+ 45 - 0
database/migrations/2018_05_04_054007_create_reports_table.php

@@ -0,0 +1,45 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateReportsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('reports', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->bigInteger('profile_id')->unsigned();
+            $table->bigInteger('user_id')->unsigned()->nullable();
+            $table->bigInteger('object_id')->unsigned();
+            $table->string('object_type')->nullable();
+            $table->bigInteger('reported_profile_id')->unsigned()->nullable();
+            $table->string('type')->nullable();
+            $table->string('message')->nullable();
+            $table->timestamp('admin_seen')->nullable();
+            $table->boolean('not_interested')->default(false);
+            $table->boolean('spam')->default(false);
+            $table->boolean('nsfw')->default(false);
+            $table->boolean('abusive')->default(false);
+            $table->json('meta')->nullable();
+            $table->unique(['user_id', 'object_type', 'object_id']);
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('reports');
+    }
+}