Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgergo committed Sep 2, 2024
1 parent 8b8f1cb commit b39ccc4
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/Breadcrumbs/Registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
namespace Cone\Root\Breadcrumbs;

use Closure;
use Cone\Root\Interfaces\Breadcrumbs\Registry as Contract;
use Illuminate\Http\Request;
use Illuminate\Routing\Route;

class Registry
class Registry implements Contract
{
/**
* The registered patterns.
Expand Down
24 changes: 24 additions & 0 deletions src/Interfaces/Breadcrumbs/Registry.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace Cone\Root\Interfaces\Breadcrumbs;

use Closure;
use Illuminate\Http\Request;

interface Registry
{
/**
* Register a set of patterns.
*/
public function patterns(array $patterns): void;

/**
* Register a pattern.
*/
public function pattern(string $pattern, Closure|string $label): void;

/**
* Resolve the breadcrumbs using the given request.
*/
public function resolve(Request $request): array;
}
18 changes: 18 additions & 0 deletions src/Interfaces/Navigation/Registry.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace Cone\Root\Interfaces\Navigation;

use Cone\Root\Navigation\Location;

interface Registry
{
/**
* Get or register a new the location.
*/
public function location(string $name): Location;

/**
* Get the registered. locations
*/
public function locations(): array;
}
4 changes: 3 additions & 1 deletion src/Navigation/Registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

namespace Cone\Root\Navigation;

class Registry
use Cone\Root\Interfaces\Navigation\Registry as Contract;

class Registry implements Contract
{
/**
* The navigation locations.
Expand Down
8 changes: 4 additions & 4 deletions src/Root.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace Cone\Root;

use Closure;
use Cone\Root\Breadcrumbs\Registry as Breadcrumbs;
use Cone\Root\Interfaces\Breadcrumbs\Registry as Breadcrumbs;
use Cone\Root\Interfaces\Navigation\Registry as Navigation;
use Cone\Root\Models\User;
use Cone\Root\Navigation\Registry as Navigation;
use Cone\Root\Resources\Resources;
use Cone\Root\Widgets\Widgets;
use DateTimeZone;
Expand Down Expand Up @@ -73,8 +73,8 @@ public function __construct(Application $app)
$this->app = $app;
$this->resources = new Resources;
$this->widgets = new Widgets;
$this->navigation = new Navigation;
$this->breadcrumbs = new Breadcrumbs;
$this->navigation = $app->make(Navigation::class);
$this->breadcrumbs = $app->make(Breadcrumbs::class);
$this->timezone = $app['config']->get('app.timezone');
}

Expand Down
2 changes: 2 additions & 0 deletions src/RootServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ class RootServiceProvider extends ServiceProvider
* @var array
*/
public $bindings = [
Interfaces\Breadcrumbs\Registry::class => Breadcrumbs\Registry::class,
Interfaces\Models\AuthCode::class => Models\AuthCode::class,
Interfaces\Models\Medium::class => Models\Medium::class,
Interfaces\Models\Meta::class => Models\Meta::class,
Interfaces\Models\Notification::class => Models\Notification::class,
Interfaces\Models\User::class => Models\User::class,
Interfaces\Navigation\Registry::class => Navigation\Registry::class,
];

/**
Expand Down

0 comments on commit b39ccc4

Please sign in to comment.