PHP code example of nuewire / platform
1. Go to this page and download the library: Download nuewire/platform library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nuewire / platform example snippets
use Nuewire\Platform\Navigation\NavigationRegistry;
app(NavigationRegistry::class)
->registerArea('content', [
'label' => ['id' => 'Konten', 'en' => 'Content'],
'order' => 20,
])
->registerGroup('content', 'publishing', [
'label' => ['id' => 'Publikasi', 'en' => 'Publishing'],
'order' => 10,
])
->register('blog.posts', [
'area' => 'content',
'group' => 'publishing',
'slug' => 'posts',
'label' => ['id' => 'Artikel', 'en' => 'Posts'],
'description' => ['id' => 'Kelola artikel.', 'en' => 'Manage posts.'],
'component' => 'blog::posts',
'permission' => 'posts.view',
'icon' => 'content',
'order' => 10,
]);
'visible' => fn (): bool => config('blog.enabled'),
'badge' => fn (): ?string => '3',
'user_menu' => [
'profile_route' => 'profile.edit',
'logout_route' => 'logout',
],
use Nuewire\Platform\Dashboard\DashboardRegistry;
use Nuewire\Platform\Dashboard\WidgetContext;
app(DashboardRegistry::class)
->registerGroup('publishing', [
'label' => ['id' => 'Publikasi', 'en' => 'Publishing'],
'order' => 20,
])
->register('blog.posts-total', [
'group' => 'publishing',
'label' => ['id' => 'Total Artikel', 'en' => 'Total Posts'],
'description' => ['id' => 'Jumlah artikel.', 'en' => 'Number of posts.'],
'type' => 'stat',
'permission' => 'posts.view',
'width' => 3,
'default' => true,
'cache_ttl' => 300,
'cache_scope' => 'global',
'resolver' => static fn (WidgetContext $context): array => [
'value' => number_format(Post::query()->count()),
'url' => $context->route('content', 'posts'),
],
]);
bash
composer migrate
php artisan optimize:clear
bash
php artisan vendor:publish --tag=nuewire-platform-config
php artisan vendor:publish --tag=nuewire-platform-views
php artisan vendor:publish --tag=nuewire-platform-translations
bash
php artisan migrate
php artisan nuewire:acl:sync # when ACL is installed
php artisan optimize:clear
bash
php artisan nuewire:dashboard:list
php artisan nuewire:dashboard:reset --user=123
php artisan nuewire:dashboard:reset --role=administrator
php artisan nuewire:dashboard:reset --platform
php artisan nuewire:dashboard:export --role=administrator --path=dashboard.json
php artisan nuewire:dashboard:import dashboard.json --role=administrator
php artisan nuewire:dashboard:clear-cache