Add Report model/migration/controller

This commit is contained in:
Daniel Supernault 2018-05-20 15:48:53 -06:00
parent 1302790297
commit 31a238e925
3 changed files with 93 additions and 0 deletions

View File

@ -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
app/Report.php Normal file
View File

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

View File

@ -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');
}
}