Add like model, migration and controller

This commit is contained in:
Daniel Supernault 2018-04-16 19:35:01 -06:00
parent fbeac9c1d9
commit 5d710d5574
3 changed files with 63 additions and 0 deletions

View file

@ -0,0 +1,10 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class LikeController extends Controller
{
//
}

18
app/Like.php Normal file
View file

@ -0,0 +1,18 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Like extends Model
{
public function actor()
{
return $this->belongsTo(Profile::class);
}
public function status()
{
return $this->belongsTo(Status::class);
}
}

View file

@ -0,0 +1,35 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateLikesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('likes', function (Blueprint $table) {
$table->bigIncrements('id');
$table->bigInteger('profile_id')->unsigned();
$table->bigInteger('status_id')->unsigned();
// Flag to remove spammy profile_ids
$table->boolean('flagged')->default(false);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('likes');
}
}