Casts
1 month ago
Concerns
1 month ago
Factories
1 month ago
Relations
1 month ago
BroadcastableModelEventOccurred.php
1 month ago
BroadcastsEvents.php
6 months ago
Builder.php
1 month ago
Collection.php
1 month ago
HigherOrderBuilderProxy.php
2 years ago
InvalidCastException.php
2 years ago
JsonEncodingException.php
2 years ago
MassAssignmentException.php
2 years ago
MassPrunable.php
6 months ago
MissingAttributeException.php
1 month ago
Model.php
1 month ago
ModelNotFoundException.php
1 month ago
PendingHasThroughRelationship.php
1 month ago
Prunable.php
2 years ago
QueueEntityResolver.php
2 years ago
RelationNotFoundException.php
2 years ago
Scope.php
2 years ago
SoftDeletes.php
1 month ago
SoftDeletingScope.php
1 month ago
QueueEntityResolver.php
28 lines
| 1 | <?php |
| 2 | |
| 3 | namespace IAWPSCOPED\Illuminate\Database\Eloquent; |
| 4 | |
| 5 | use IAWPSCOPED\Illuminate\Contracts\Queue\EntityNotFoundException; |
| 6 | use IAWPSCOPED\Illuminate\Contracts\Queue\EntityResolver as EntityResolverContract; |
| 7 | /** @internal */ |
| 8 | class QueueEntityResolver implements EntityResolverContract |
| 9 | { |
| 10 | /** |
| 11 | * Resolve the entity for the given ID. |
| 12 | * |
| 13 | * @param string $type |
| 14 | * @param mixed $id |
| 15 | * @return mixed |
| 16 | * |
| 17 | * @throws \Illuminate\Contracts\Queue\EntityNotFoundException |
| 18 | */ |
| 19 | public function resolve($type, $id) |
| 20 | { |
| 21 | $instance = (new $type())->find($id); |
| 22 | if ($instance) { |
| 23 | return $instance; |
| 24 | } |
| 25 | throw new EntityNotFoundException($type, $id); |
| 26 | } |
| 27 | } |
| 28 |