1
0
Fork 0
forked from mirror/pixelfed

Merge pull request #429 from pixelfed/frontend-ui-refactor

Add FollowRequest model/migration
This commit is contained in:
daniel 2018-09-01 22:29:27 -06:00 committed by GitHub
commit 0b56823429
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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');
}
}