[...]). */ class FeedActions { /** * @return list */ public static function for(User $user): array { $access = app(PluginAccess::class); $actions = []; $add = function (string $plugin, string $route, string $label, string $icon) use (&$actions, $access, $user) { if (Route::has($route) && $access->allows($plugin, $user)) { $actions[] = ['label' => $label, 'url' => route($route), 'icon' => $icon]; } }; if ($user->can('news.manage')) { $add('news', 'news.editor.create', 'Beitrag schreiben', 'pen-line'); } $add('it-service', 'it-service.tickets.create', 'Problem melden', 'circle-alert'); $add('forms', 'forms.index', 'Formular finden', 'file-text'); $add('ideen', 'ideas.index', 'Idee einreichen', 'lightbulb'); $actions = Hooks::apply('feed.actions', $actions, $user); return array_values(array_filter((array) $actions, fn ($action) => is_array($action) && isset($action['label'], $action['url']))); } }