feat: moderation
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Concerns;
|
||||
|
||||
use App\Services\ContentModerationService;
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
|
||||
trait ModeratesUserContent
|
||||
{
|
||||
/**
|
||||
* @param array<int, mixed> $texts
|
||||
* @param array<int, mixed> $images
|
||||
* @return array<int, callable>
|
||||
*/
|
||||
protected function moderationChecks(array $texts, array $images = []): array
|
||||
{
|
||||
return [function (Validator $validator) use ($texts, $images): void {
|
||||
if ($validator->errors()->isNotEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
app(ContentModerationService::class)->ensureAcceptable($texts, $images);
|
||||
}];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user