Ideenbox (0.33.0)
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 9m16s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 9m12s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 9m52s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 9m47s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 10m4s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 10m6s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 8m6s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 56s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 8m56s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m53s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 9m16s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 9m12s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 9m52s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 9m47s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 10m4s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 10m6s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 8m6s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 56s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 8m56s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m53s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
bd7536ab82
commit
858e248d26
160 changed files with 1543 additions and 348 deletions
37
plugins-core/ideen/src/IdeenPlugin.php
Normal file
37
plugins-core/ideen/src/IdeenPlugin.php
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\Ideen;
|
||||
|
||||
use App\Dashboard\Widgets;
|
||||
use App\Editorial\Editorial;
|
||||
use App\Models\User;
|
||||
use App\Plugins\Plugin;
|
||||
use App\Support\Abilities;
|
||||
use App\Support\Navigation;
|
||||
use Inhaus\Plugins\Ideen\Models\Idea;
|
||||
|
||||
class IdeenPlugin extends Plugin
|
||||
{
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->make(Navigation::class)->add('ideen', 'Ideenbox', '/ideen', active: 'ideas.*', sort: 76);
|
||||
$this->app->make(Abilities::class)->define('ideas.manage', 'Ideen bewerten, beantworten und moderieren (Gremium)', 'Ideenbox', portal: true);
|
||||
|
||||
// Redaktion: was das Gremium noch sichten muss
|
||||
$this->app->make(Editorial::class)->add('ideen', 'Ideenbox', 'ideen::EditorialIdeas', 34,
|
||||
fn (User $user) => $user->can('ideas.manage'),
|
||||
fn (User $user) => [
|
||||
'ideas' => Idea::query()->with('author')->whereIn('status', ['new', 'review'])
|
||||
->orderByRaw("status = 'new' DESC")->orderByDesc('supports_count')->latest()->limit(30)->get()
|
||||
->map(fn (Idea $idea) => Presenter::card($idea))->all(),
|
||||
]);
|
||||
|
||||
// Startseite: beliebteste offene Ideen
|
||||
$this->app->make(Widgets::class)->add('ideen.popular', 'ideen::Popular', 'aside', sort: 28, props: function () {
|
||||
$ideas = Idea::query()->with('author')->whereIn('status', ['new', 'review'])->where('created_at', '>=', now()->subDays(60))
|
||||
->orderByDesc('supports_count')->latest()->limit(3)->get();
|
||||
|
||||
return $ideas->isEmpty() ? null : ['ideas' => $ideas->map(fn (Idea $idea) => Presenter::card($idea))->all()];
|
||||
}, label: 'Ideenbox', mobileSort: 38);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue