Add like model, migration and controller

pull/9/head
Daniel Supernault 2018-04-16 19:35:01 -06:00
rodzic fbeac9c1d9
commit 5d710d5574
3 zmienionych plików z 63 dodań i 0 usunięć

Wyświetl plik

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

18
app/Like.php 100644
Wyświetl plik

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

Wyświetl plik

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