-
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
94fbc24
commit 65533e3
Showing
9 changed files
with
80 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
/.docker export-ignore | ||
/.github export-ignore | ||
/tests export-ignore | ||
/types export-ignore | ||
.gitattributes export-ignore | ||
.gitignore export-ignore | ||
docker-compose.ci.yml export-ignore | ||
docker-compose.yml export-ignore | ||
phpstan.neon.dist export-ignore | ||
phpstan.types.neon.dist export-ignore | ||
phpunit.xml.dist export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
includes: | ||
- ./vendor/larastan/larastan/extension.neon | ||
parameters: | ||
level: 9 | ||
paths: | ||
- types |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace Staudenmeir\EloquentJsonRelations\Types\Models; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
use Staudenmeir\EloquentJsonRelations\HasJsonRelationships; | ||
|
||
class Project extends Model | ||
{ | ||
use HasJsonRelationships; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace Staudenmeir\EloquentJsonRelations\Types\Models; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
use Staudenmeir\EloquentJsonRelations\HasJsonRelationships; | ||
|
||
class Role extends Model | ||
{ | ||
use HasJsonRelationships; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace Staudenmeir\EloquentJsonRelations\Types\Models; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
use Staudenmeir\EloquentJsonRelations\HasJsonRelationships; | ||
|
||
class User extends Model | ||
{ | ||
use HasJsonRelationships; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace Staudenmeir\EloquentJsonRelations\Types; | ||
|
||
use Staudenmeir\EloquentJsonRelations\JsonKey; | ||
use Staudenmeir\EloquentJsonRelations\Types\Models\Project; | ||
use Staudenmeir\EloquentJsonRelations\Types\Models\Role; | ||
use Staudenmeir\EloquentJsonRelations\Types\Models\User; | ||
|
||
use function PHPStan\Testing\assertType; | ||
|
||
function test(Role $role, User $user): void | ||
{ | ||
assertType( | ||
'Staudenmeir\EloquentJsonRelations\Relations\BelongsToJson<Staudenmeir\EloquentJsonRelations\Types\Models\Role, Staudenmeir\EloquentJsonRelations\Types\Models\User>', | ||
$user->belongsToJson(Role::class, 'role_ids') | ||
); | ||
|
||
assertType( | ||
'Staudenmeir\EloquentJsonRelations\Relations\HasManyJson<Staudenmeir\EloquentJsonRelations\Types\Models\User, Staudenmeir\EloquentJsonRelations\Types\Models\Role>', | ||
$role->hasManyJson(User::class, 'role_ids') | ||
); | ||
|
||
assertType( | ||
'Staudenmeir\EloquentJsonRelations\Relations\HasOneJson<Staudenmeir\EloquentJsonRelations\Types\Models\User, Staudenmeir\EloquentJsonRelations\Types\Models\Role>', | ||
$role->hasOneJson(User::class, 'role_ids') | ||
); | ||
|
||
assertType( | ||
'Staudenmeir\EloquentHasManyDeep\HasManyDeep<Staudenmeir\EloquentJsonRelations\Types\Models\Project, Staudenmeir\EloquentJsonRelations\Types\Models\Role>', | ||
$role->hasManyThroughJson(Project::class, User::class, new JsonKey('role_ids')) | ||
); | ||
} |