Skip to main content Skip to navigation

Guides: Constructor Classes

Constructor classes

The Constructor Classes are a set of abstract php classes which are used to create the different parts of Hiker's Chrome.

Here's an example of how the NavigationConstructor is used to create the navigation part of the Chrome

<?php

namespace App\Hiker\Chrome;

use Hiker\Components\Navigation\Link;
use Hiker\Components\Navigation\NavigationConstructor;

class Navigation extends NavigationConstructor
{
    protected function links(): array
    {
        return array_filter([
            Link::resource(Cats::class)
                ->order(10)
                ->keyCode('cats'),

            Link::resource(Dogs::class)
                ->order(20)
                ->keyCode('dogs'),
    }
}

In this example, the links() method of the NavigationConstructor is used to create the list of links found in the navigation. In the NavigationConstructor, the links() method is defined as so:

abstract protected function links(): array;

This makes it a method that is required in the above Navigation class.

You can find the documentation for the different constructor classes with their specific methods here: