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.
});
}
}