From 75db5116b7453115b192af9d4379148509fe3105 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 17 May 2023 03:53:05 -0600 Subject: [PATCH] Add AutospamCustomTokens model + migration --- app/Models/AutospamCustomTokens.php | 11 ++++++ config/autospam.php | 37 +++++++++++++++++++ ...04_create_autospam_custom_tokens_table.php | 34 +++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 app/Models/AutospamCustomTokens.php create mode 100644 config/autospam.php create mode 100644 database/migrations/2023_05_15_050604_create_autospam_custom_tokens_table.php diff --git a/app/Models/AutospamCustomTokens.php b/app/Models/AutospamCustomTokens.php new file mode 100644 index 000000000..874f41411 --- /dev/null +++ b/app/Models/AutospamCustomTokens.php @@ -0,0 +1,11 @@ + env('PF_BOUNCER_ENABLED', false), + + + /* + |-------------------------------------------------------------------------- + | Ignored Tokens + |-------------------------------------------------------------------------- + | + | Ignored tokens are for commonly used words that may impact the detection. + | These tokens should be lowercase and not contain spaces or non alpha- + | numerical characters and be in comma-separated format. + | + */ + + 'ignored_tokens' => env('PF_AUTOSPAM_IGNORED_TOKENS', 'the,a,of,and'), + + 'nlp' => [ + 'enabled' => false, + 'spam_sample_limit' => env('PF_AUTOSPAM_NLP_SPAM_SAMPLE_LIMIT', 200), + ] +]; diff --git a/database/migrations/2023_05_15_050604_create_autospam_custom_tokens_table.php b/database/migrations/2023_05_15_050604_create_autospam_custom_tokens_table.php new file mode 100644 index 000000000..e2f7f7e66 --- /dev/null +++ b/database/migrations/2023_05_15_050604_create_autospam_custom_tokens_table.php @@ -0,0 +1,34 @@ +bigIncrements('id'); + $table->string('token')->index(); + $table->integer('weight')->default(1)->index(); + $table->boolean('is_spam')->default(true)->index(); + $table->text('note')->nullable(); + $table->string('category')->nullable()->index(); + $table->boolean('active')->default(false)->index(); + $table->unique(['token', 'category']); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('autospam_custom_tokens'); + } +};