PHP code example of rahmanramsi / livewire-page-group

1. Go to this page and download the library: Download rahmanramsi/livewire-page-group 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/ */

    

rahmanramsi / livewire-page-group example snippets




namespace App\Providers;

use App\Livewire\Admin\Dashboard;
use App\Livewire\Admin\Users\ListUsers;
use Illuminate\Support\Facades\Route;
use Rahmanramsi\LivewirePageGroup\PageGroup;
use Rahmanramsi\LivewirePageGroup\PageGroupServiceProvider;

class AdminPageGroupServiceProvider extends PageGroupServiceProvider
{
    public function pageGroup(PageGroup $pageGroup): PageGroup
    {
        return $pageGroup
            ->id('admin')
            ->path('admin')
            ->domain(config('app.admin_domain'))
            ->homePage(Dashboard::class)
            ->layout('layouts.admin')
            ->middleware(['web', 'auth'])
            ->pages([
                ListUsers::class,
            ])
            ->discoverPages(
                app_path('Livewire/Admin'),
                'App\\Livewire\\Admin',
            )
            ->routes(function (PageGroup $pageGroup): void {
                Route::get('/health', fn (): string => "{$pageGroup->getId()} is healthy")
                    ->name('health');
            })
            ->bootUsing(function (PageGroup $pageGroup): void {
                // Run once when this group is selected for the request.
            });
    }
}



namespace App\Livewire\Admin\Users;

use Rahmanramsi\LivewirePageGroup\Pages\Page;

class ListUsers extends Page
{
    protected static ?string $title = 'Users';

    protected static ?string $slug = 'users';

    protected static string $view = 'livewire.admin.users.list-users';
}
text
livewirePageGroup.admin.pages.*
livewirePageGroup.admin.*
bash
php artisan make:livewire-page Users/ListUsers --group=admin