feat: add reciprocal user blocking
CI / 🧪 Tests Laravel (push) Successful in 2m6s
CI / 🐳 Build & Push Image (push) Successful in 39s

This commit is contained in:
2026-08-11 15:58:31 +02:00
parent 6b757c37be
commit cef3e29ddc
15 changed files with 420 additions and 17 deletions
+25
View File
@@ -0,0 +1,25 @@
<?php
namespace App\Actions;
use App\Models\User;
use App\Models\UserBlock;
use Illuminate\Support\Facades\DB;
class BlockUser
{
public function execute(User $blocker, User $blocked): UserBlock
{
return DB::transaction(function () use ($blocker, $blocked): UserBlock {
$userBlock = UserBlock::query()->firstOrCreate([
'blocker_id' => $blocker->getKey(),
'blocked_id' => $blocked->getKey(),
]);
$blocker->following()->detach($blocked->getKey());
$blocker->followers()->detach($blocked->getKey());
return $userBlock;
});
}
}