Domain\Repositories\Traits\GetsTrait::get PHP 메소드

get() 공개 메소드

Get item of model by id :id.
public get ( integer $id, array $columns = ['*'], array $with = [], array $load = [] ) : Domains\BaseModel
$id integer
$columns array
$with array
$load array
리턴 Domains\BaseModel
    public function get($id, array $columns = ['*'], array $with = [], array $load = [])
    {
        $item = $this->model;
        if (!empty($with)) {
            $item = $item->with($with);
        }
        $item = $item->find($id, $columns);
        if (!empty($load) and !is_null($item)) {
            $item->load($load);
        }
        if ($item) {
            return $item;
        }
        throw new RepositoryException('Item not found');
    }