Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Failing after 15m6s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Failing after 15m58s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Failing after 15m42s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Failing after 15m21s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 1h1m41s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 1h2m13s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 23m20s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 23m33s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 1m17s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m57s
Feed-Registry mit Anbietern (Neu im Team, Neuigkeiten, Termine, Umfragen), Schnellaktionen je nach Rechten, Nachladen über /feed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
35 lines
1.2 KiB
PHP
35 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Feed;
|
|
|
|
use App\Models\User;
|
|
use Carbon\CarbonImmutable;
|
|
|
|
/**
|
|
* Einträge des Kerns im Feed: neue Kolleginnen und Kollegen.
|
|
*/
|
|
class CoreFeed
|
|
{
|
|
public static function register(Feed $feed): void
|
|
{
|
|
$feed->add('people', fn (User $user, ?CarbonImmutable $before, int $limit) => User::query()
|
|
->active()
|
|
->whereKeyNot($user->getKey())
|
|
->where('created_at', '>=', now()->subDays(120))
|
|
->when($before, fn ($query) => $query->where('created_at', '<', $before))
|
|
->latest()
|
|
->limit($limit)
|
|
->get()
|
|
->map(fn (User $person) => [
|
|
'id' => 'person-'.$person->id,
|
|
'kind' => 'welcome',
|
|
'time' => $person->created_at,
|
|
'actor' => Feed::person($person),
|
|
'badge' => 'Neu im Team',
|
|
'title' => $person->name.' ist neu im Team',
|
|
'text' => implode(' · ', array_filter([$person->job_title, $person->department, $person->location])),
|
|
'url' => route('people.show', $person),
|
|
'cta' => ['label' => 'Profil ansehen', 'url' => route('people.show', $person)],
|
|
]));
|
|
}
|
|
}
|