The AccountConstructor
is one of the Constructor Classes
of Hiker. It's used to create the account part of the Chrome
.
Here's an example of how it's used:
<?php namespace App\Hiker\Chrome; use Hiker\Components\Account\AccountConstructor; class Account extends AccountConstructor { protected function extra(): ?string { if (! ($company = Hiker::profile('companies')->get())) { return null; } return $company->label; } protected function sections(): array { return [ $this->getAccountHead(), $this->getProfileSection(), ]; } // Add whatever methods you need }
Required methods
sections(): array
Description:
Return application-defined sections
Example:
protected function sections(): array { return [ Head::make('Cats'), Section::make('Famous cats', ['firstname' => 'Gardfield', 'lastname' => 'Arbuckle']) ]; }
extra(): ?string
Description:
Return optional extra information to append to the username.
Example:
protected function extra(): ?string { return "Cats don't usually love italian food, but Gardfield does"; }