Skip to content

Commit b4bad3f

Browse files
authored
Add bindings for eloquent collection and nav trees (#203)
1 parent ef1fd2b commit b4bad3f

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
},
2525
"require": {
2626
"php": "^8.0",
27-
"statamic/cms": "^4.16"
27+
"statamic/cms": "^4.21"
2828
},
2929
"require-dev": {
3030
"doctrine/dbal": "^3.3",

src/Structures/CollectionTreeRepository.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Statamic\Eloquent\Structures;
44

5+
use Statamic\Contracts\Structures\CollectionTree as CollectionTreeContract;
56
use Statamic\Contracts\Structures\Tree as TreeContract;
67
use Statamic\Facades\Blink;
78
use Statamic\Stache\Repositories\CollectionTreeRepository as StacheRepository;
@@ -29,4 +30,11 @@ public function save($entry)
2930

3031
$entry->model($model->fresh());
3132
}
33+
34+
public static function bindings()
35+
{
36+
return [
37+
CollectionTreeContract::class => CollectionTree::class,
38+
];
39+
}
3240
}

src/Structures/NavTreeRepository.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Statamic\Eloquent\Structures;
44

5+
use Statamic\Contracts\Structures\NavTree as NavTreeContract;
56
use Statamic\Contracts\Structures\Tree as TreeContract;
67
use Statamic\Facades\Blink;
78
use Statamic\Stache\Repositories\NavTreeRepository as StacheRepository;
@@ -44,4 +45,11 @@ public function delete($entry)
4445

4546
$entry->model()->delete();
4647
}
48+
49+
public static function bindings()
50+
{
51+
return [
52+
NavTreeContract::class => NavTree::class,
53+
];
54+
}
4755
}

0 commit comments

Comments
 (0)