Browse Source

Add Domain Blocks

Daniel Supernault 1 năm trước cách đây
mục cha
commit
5cea5aab3c

+ 21 - 0
app/Models/UserDomainBlock.php

@@ -0,0 +1,21 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Factories\HasFactory;
+use Illuminate\Database\Eloquent\Model;
+use App\Profile;
+
+class UserDomainBlock extends Model
+{
+    use HasFactory;
+
+    protected $guarded = [];
+
+    public $timestamps = false;
+
+    public function profile()
+    {
+        return $this->belongsTo(Profile::class, 'profile_id');
+    }
+}

+ 2 - 1
config/instance.php

@@ -110,7 +110,8 @@ return [
 
 	'user_filters' => [
 		'max_user_blocks' => env('PF_MAX_USER_BLOCKS', 50),
-		'max_user_mutes' => env('PF_MAX_USER_MUTES', 50)
+		'max_user_mutes' => env('PF_MAX_USER_MUTES', 50),
+		'max_domain_blocks' => env('PF_MAX_DOMAIN_BLOCKS', 50),
 	],
 
 	'reports' => [

+ 29 - 0
database/migrations/2023_12_16_052413_create_user_domain_blocks_table.php

@@ -0,0 +1,29 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     */
+    public function up(): void
+    {
+        Schema::create('user_domain_blocks', function (Blueprint $table) {
+            $table->id();
+            $table->unsignedBigInteger('profile_id')->index();
+            $table->string('domain');
+            $table->unique(['profile_id', 'domain'], 'user_domain_blocks_by_id');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('user_domain_blocks');
+    }
+};