Find

@param  string $id
@param  array $with

@return \Illuminate\Database\Eloquent\Model
355798
public function find($id, array $with = [])
    {
        $key = $this->getKey($id, $with);

        $tags = $this->getTags($id, $with);

        if ($this->cache->has($key, $tags)) {
            return $this->cache->get($key, $tags);
        }

        $model = $this->repo->find($id, $with);

        $this->cache->put($key, $model, $tags);

        return $model;
    }
1343314
public function find($id)
    {
        if (! is_numeric($id) && is_string($id)) {
            return $this->findBySlug($id);
        }

        return $this->plugger
            ->setModel($this)
            ->setAdapter(Post::class)
            ->plugIn(get_post($id))
            ->getConnected()
            ->first();
    }
239342
protected function findModel($id)
    {
        $class = $this->modelClass;
        if (($model = $class::findOne($id)) !== null) {
            return $model;
        } else {
            throw new NotFoundHttpException('The requested page does not exist.');
        }
    }
1013434
public function findModel($id)
    {
        if (($model = Category::findOne($id)) !== null) {
            return $model;
        } else {
            throw new NotFoundHttpException (Yii::t('system', 'The requested page does not exist.'));
        }
    }
577087
protected function findModel($id)
    {
        if (($model = Message::find()
                ->where(['id' => $id, 'parent' => null])->andWhere(['or', ['from_id' => Yii::$app->user->id], ['user_id' => Yii::$app->user->id]])->limit(1)->one()) !== null
        ) {
            return $model;
        } else {
            throw new NotFoundHttpException (Yii::t('message', 'The requested page does not exist.'));
        }
    }
338462
public function findById($id)
    {
        $queryBuilder = $this->createQueryBuilder('a')
            ->addSelect('domains')
            ->leftJoin('a.domains', 'domains')
            ->where('a.id = :id');

        $query = $queryBuilder->getQuery();
        $query->setParameter('id', $id);

        return $query->getSingleResult();
    }
488874
public function find($id)
    {
        $result = $this->model->findOrFail($id)->toArray();

        return $this->export($result);
    }
1055002
public function findWhereOrFail(int $id, array $parameters)
    {
        $response = $this->model->with($this->with)->where($parameters)->findOrFail($id);
        $this->with = [];
        return $response;
    }
978840
public static function findById($id)
    {
        if (!$id || strlen($id) != 24) {
            return null;
        }
        $instance = static::entity()->get(get_called_class(), $id);
        if ($instance) {
            return $instance;
        }
        $mongo = static::entity()->getDatabase();
        $data = $mongo->findOne(static::$collection, ['_id' => $mongo->id($id)]);
        if (!$data) {
            return null;
        }
        $instance = new static;
        $data['__webiny_db__'] = true;
        $instance->populate($data);

        return static::entity()->add($instance);
    }
1022361
public function find(int $id)
    {
        $response = $this->model->with($this->with)->find($id);
        $this->with = [];
        return $response;
    }
521470
private function find($id): ?Model
    {
        try {
            return $this->repository->findOrFail($id);
        } catch (ModelNotFoundException $exception) {
            return null;
        }
    }
134311
public function find($controller, $id)
    {
        $model = $controller->model();
        if ($controller->withTrashed()) {
            return $model::withTrashed()->find($id);
        } else {
            return $model::find($id);
        }
    }
397031
protected function with($with = null, $mode = self::MODE_OR)
    {
        if ($with instanceof GenericCollection) {
            $with = $with->toArray();
        }

        if (is_array($with)) {
            return $this->andWith((array) $with, $mode);
        }

        return $with;
    }
812442
protected function findOrFail($id)
    {
        $model = $this->model;
        if ($this->withTrashed()) {
            return $model::withTrashed()->findOrFail($id);
        } else {
            return $model::findOrFail($id);
        }
    }
84430
protected function findModel($id)
    {
        if (($model = Order::findOne($id)) !== null) {
            return $model;
        } else {
            throw new NotFoundHttpException(t('app', 'The requested page does not exist.'));
        }
    }
311893
public function find($id)
    {
        $data = $this->client->get(Inflector::pluralize($this->getResourceName()).'/'.$id);

        return $this->fromArray(reset($data));
    }
760987
final public static function find($id, $withTrash = false)
    {
        if ($id === null) {
            return null;
        }
        $instance = static::getRepository()
            ->find($id);
        // use this to avoid lint error in idea
        if ($instance instanceof static) {
            if ($instance->getDeletedAt() && !$withTrash) {
                return null;
            }
            return $instance;
        } else {
            return null;
        }
    }