Add FollowRequest model/migration

This commit is contained in:
Daniel Supernault 2018-09-01 22:28:01 -06:00
parent a9b7117db9
commit f9fc8e2f64
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
2 changed files with 53 additions and 0 deletions

18
app/FollowRequest.php Normal file
View file

@ -0,0 +1,18 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class FollowRequest extends Model
{
public function follower()
{
return $this->belongsTo(Profile::class, 'follower_id', 'id');
}
public function following()
{
return $this->belongsTo(Profile::class, 'following_id', 'id');
}
}

View file

@ -0,0 +1,35 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateFollowRequestsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('follow_requests', function (Blueprint $table) {
$table->bigIncrements('id');
$table->bigInteger('follower_id')->unsigned()->index();
$table->bigInteger('following_id')->unsigned()->index();
$table->boolean('is_rejected')->default(false);
$table->boolean('is_local')->default(false);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('follow_requests');
}
}