Skip to content

Commit 3556acb

Browse files
authored
fix(database): support route binding through IsDatabaseModel (#1794)
1 parent 2a7a54c commit 3556acb

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

packages/database/src/IsDatabaseModel.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ public static function findById(string|int|PrimaryKey $id): self
6868
}
6969

7070
/**
71-
* Finds a model instance by its ID.
71+
* Finds a model instance by its ID. Use through {@see Tempest\Router\Bindable}.
7272
*/
73-
public static function resolve(string|int|PrimaryKey $id): self
73+
public static function resolve(string $input): self
7474
{
75-
return query(self::class)->resolve($id);
75+
return query(self::class)->resolve($input);
7676
}
7777

7878
/**

packages/router/src/Bindable.php

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

33
namespace Tempest\Router;
44

5+
/**
6+
* Allows resolving the implementing class through a route parameter.
7+
*/
58
interface Bindable
69
{
10+
/**
11+
* Resolves the implementing class through the given input.
12+
*/
713
public static function resolve(string $input): self;
814
}

0 commit comments

Comments
 (0)