Răsfoiți Sursa

Add AdminShadowFilter model/migration

Daniel Supernault 1 an în urmă
părinte
comite
a510c3e89c

+ 27 - 0
app/Models/AdminShadowFilter.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Factories\HasFactory;
+use Illuminate\Database\Eloquent\Model;
+use App\Services\AccountService;
+
+class AdminShadowFilter extends Model
+{
+    use HasFactory;
+
+    protected $guarded = [];
+
+    protected $casts = [
+        'created_at' => 'datetime'
+    ];
+
+    public function account()
+    {
+        if($this->item_type === 'App\Profile') {
+            return AccountService::get($this->item_id, true);
+        }
+
+        return;
+    }
+}

+ 47 - 0
database/migrations/2023_09_12_044900_create_admin_shadow_filters_table.php

@@ -0,0 +1,47 @@
+<?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('admin_shadow_filters', function (Blueprint $table) {
+            $table->id();
+            $table->unsignedBigInteger('admin_id')->nullable();
+            $table->morphs('item');
+            $table->boolean('is_local')->default(true)->index();
+            $table->text('note')->nullable();
+            $table->boolean('active')->default(false)->index();
+            $table->json('history')->nullable();
+            $table->json('ruleset')->nullable();
+            $table->boolean('prevent_ap_fanout')->default(false)->index();
+            $table->boolean('prevent_new_dms')->default(false)->index();
+            $table->boolean('ignore_reports')->default(false)->index();
+            $table->boolean('ignore_mentions')->default(false)->index();
+            $table->boolean('ignore_links')->default(false)->index();
+            $table->boolean('ignore_hashtags')->default(false)->index();
+            $table->boolean('hide_from_public_feeds')->default(false)->index();
+            $table->boolean('hide_from_tag_feeds')->default(false)->index();
+            $table->boolean('hide_embeds')->default(false)->index();
+            $table->boolean('hide_from_story_carousel')->default(false)->index();
+            $table->boolean('hide_from_search_autocomplete')->default(false)->index();
+            $table->boolean('hide_from_search')->default(false)->index();
+            $table->boolean('requires_login')->default(false)->index();
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('admin_shadow_filters');
+    }
+};