'required', ]; if (! $this->validate($rules)) { return redirect() ->back() ->withInput() ->with('errors', $this->validator->getErrors()); } $handle = $this->request->getPost('handle'); if ($parts = split_handle($handle)) { if ( ($actor = get_or_create_actor($parts['username'], $parts['domain'])) === null ) { return redirect() ->back() ->withInput() ->with('error', lang('Fediverse.messages.actorNotFound')); } model('ActorModel') ->blockActor($actor->id); } return redirect()->back() ->with('message', lang('Fediverse.messages.blockActorSuccess', [ 'actor' => $handle, ])); } public function attemptUnblockActor(): RedirectResponse { $rules = [ 'actor_id' => 'required', ]; if (! $this->validate($rules)) { return redirect() ->back() ->withInput() ->with('errors', $this->validator->getErrors()); } model('ActorModel') ->unblockActor((int) $this->request->getPost('actor_id')); return redirect()->back() ->with('message', lang('Fediverse.messages.unblockActorSuccess')); } public function attemptBlockDomain(): RedirectResponse { $rules = [ 'domain' => 'required', ]; if (! $this->validate($rules)) { return redirect() ->back() ->withInput() ->with('errors', $this->validator->getErrors()); } $domain = $this->request->getPost('domain'); model('BlockedDomainModel') ->blockDomain($domain); return redirect()->back() ->with('message', lang('Fediverse.messages.blockDomainSuccess', [ 'domain' => $domain, ])); } public function attemptUnblockDomain(): RedirectResponse { $rules = [ 'domain' => 'required', ]; if (! $this->validate($rules)) { return redirect() ->back() ->withInput() ->with('errors', $this->validator->getErrors()); } $domain = $this->request->getPost('domain'); model('BlockedDomainModel') ->unblockDomain($domain); return redirect()->back() ->with('message', lang('Fediverse.messages.unblockDomainSuccess', [ 'domain' => $domain, ])); } }