Skip to content

Commit 2ae647d

Browse files
author
Nur Alam
committed
all previous beta nav generator approched removed, added new approch
1 parent ae2698e commit 2ae647d

28 files changed

+446
-2018
lines changed

config/navbar.php

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@
33
use RadiateCode\LaravelNavbar\Presenter\NavBarPresenter;
44

55
return [
6-
/**
7-
* Controllers path to generate navs
8-
*/
9-
'controllers-path' => app_path('Http/Controllers'),
10-
116
/**
127
* Presenter for navbar style
138
*
@@ -18,10 +13,8 @@
1813
/**
1914
* Cache the render navbar
2015
*/
21-
'cache-enable' => true,
22-
23-
/**
24-
* Cache living duration
25-
*/
26-
'cache-time' => now()->addDay(),
16+
'cache' => [
17+
'enable' => true,
18+
'ttl' => now()->addDay() // cache duration
19+
],
2720
];

phpunit.xml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
bootstrap="vendor/autoload.php"
5+
backupGlobals="false"
6+
backupStaticAttributes="false"
7+
colors="true"
8+
verbose="true"
9+
convertErrorsToExceptions="true"
10+
convertNoticesToExceptions="true"
11+
convertWarningsToExceptions="true"
12+
processIsolation="false"
13+
stopOnFailure="false"
14+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
15+
>
16+
<coverage>
17+
<include>
18+
<directory suffix=".php">src/</directory>
19+
</include>
20+
</coverage>
21+
<testsuites>
22+
<testsuite name="Unit">
23+
<directory suffix="Test.php">./tests/Unit</directory>
24+
</testsuite>
25+
<testsuite name="Feature">
26+
<directory suffix="Test.php">./tests/Feature</directory>
27+
</testsuite>
28+
</testsuites>
29+
</phpunit>

src/Attributes/AppendTo.php

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/Attributes/AppendableNavLinks.php

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/Attributes/Nav.php

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/Attributes/NavLinks.php

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/Attributes/ParentNav.php

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/Children.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
namespace RadiateCode\LaravelNavbar;
4+
5+
class Children
6+
{
7+
protected array $navs = [];
8+
9+
protected Nav $nav;
10+
11+
public function __construct()
12+
{
13+
$this->nav = new Nav();
14+
}
15+
16+
public function add(string $title, string $url, array $attributes = [], ?callable $configure = null): Children
17+
{
18+
$this->nav->add($title, $url, $attributes, $configure);
19+
20+
return $this;
21+
}
22+
23+
public function addIf($condition, string $title, string $url, array $attributes = [], ?callable $configure = null): Children
24+
{
25+
$condition = is_callable($condition) ? $condition() : $condition;
26+
27+
if ($condition) {
28+
$this->add($title, $url, $attributes, $configure);
29+
}
30+
31+
return $this;
32+
}
33+
34+
public function render()
35+
{
36+
return $this->nav->render();
37+
}
38+
}

src/Console/NavCacheClearCommand.php

Lines changed: 0 additions & 38 deletions
This file was deleted.

src/Contracts/NavPrepare.php

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)