PHP code example of fuelviews / laravel-navigation
1. Go to this page and download the library: Download fuelviews/laravel-navigation 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/ */
use Fuelviews\Navigation\Facades\Navigation;
// Get all navigation items
$items = Navigation::getNavigationItems();
// Check if dropdown route is active
$isActive = Navigation::isDropdownRouteActive($dropdownLinks);
// Get configuration values
$logo = Navigation::getDefaultLogo();
$phone = Navigation::getPhone();
$isTransparent = Navigation::isTransparentNavBackground();
// Check route states
$isPreScrolled = Navigation::isPreScrolledRoute();
$preScrolledString = Navigation::getPreScrolledRoute(); // 'true' or 'false'
// In a service provider
config([
'navigation.navigation' => array_merge(
config('navigation.navigation'),
[
[
'type' => 'link',
'position' => 99,
'name' => 'Admin',
'route' => 'admin.dashboard',
]
]
)
]);
// Create custom component
class CustomNavigationLink extends Component
{
public function render()
{
return view('components.custom-navigation-link');
}
}
// Register in AppServiceProvider
Blade::component('custom-nav-link', CustomNavigationLink::class);
// Feature test example
public function test_navigation_renders_correctly()
{
$response = $this->get('/');
$response->assertSeeLivewire(DesktopNavigation::class);
$response->assertSee('Home');
$response->assertSee('Services');
}