1. Go to this page and download the library: Download baconfy/core 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/ */
baconfy / core example snippets
use Baconfy\Core\ModuleProvider;
class NotesServiceProvider extends ModuleProvider
{
public function name(): string
{
return 'notes';
}
public function label(): string
{
return __('Notes');
}
public function icon(): string
{
return 'notebook-pen';
}
}
public function boot(): void
{
Route::middleware('web')
->prefix($this->name())
->name($this->name().'.')
->group(fn () => $this->loadRoutesFrom(__DIR__.'/../routes/web.php'));
$this->loadMigrationsFrom(__DIR__.'/../database/migrations');
}
use Baconfy\Core\Navigation;
public function navigation(): ?iterable
{
return [
Navigation::make(__('All notes'))->icon('list')->route('notes.index'),
Navigation::make(__('Archive'))->children(
Note::distinctYears()->map(
fn (int $year) => Navigation::make((string) $year)
->route('notes.archive', ['year' => $year]),
),
),
Navigation::make(__('Settings'))
->route('notes.settings')
->can('notes.settings'),
];
}
use Baconfy\Core\ModuleRegistry;
$registry = app(ModuleRegistry::class);
$registry->all(); // every module, sorted by order then name
$registry->visibleFor($user); // only what this user may see
$registry->get('notes'); // a single module