Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
namespace Illuminate\Database\Eloquent;
4
 
5
use Illuminate\Contracts\Queue\EntityNotFoundException;
6
use Illuminate\Contracts\Queue\EntityResolver as EntityResolverContract;
7
 
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
 
23
        if ($instance) {
24
            return $instance;
25
        }
26
 
27
        throw new EntityNotFoundException($type, $id);
28
    }
29
}