Retrieve model for route model binding

@param  mixed  $value
@return \Illuminate\Database\Eloquent\Model|null
581
public function resolveRouteBinding($value)
    {
        if (! (ctype_digit($value) || is_int($value))) {
            return null;
        }

        try {
            $value = App::make('fakeid')->decode((int) $value);
        } catch (Exception $e) {
            return null;
        }

        return $this->where($this->getRouteKeyName(), $value)->first();
    }
1206897
public function showTrack($value)
    {
        $empty  = $this->util->getTranslated()->getEmptyDropdownArray();
        if (! $value || in_array($value, $empty)) {
            return null;
        }
        if (!$value instanceof \Gems_Tracker_RespondentTrack) {
            $value = $this->loader->getTracker()->getRespondentTrack($value);
        }

        if (!$value instanceof \Gems_Tracker_RespondentTrack) {
            return null;
        }

        $name = $value->getTrackName();
        /*$startDate = $value->getStartDate();
        if ($startDate) {
            $name .= ' (' . $startDate->toString('dd-MM-yyyy') . ')';
        }*/

        if (! $this->menu instanceof \Gems_Menu) {
            $this->menu = $this->loader->getMenu();
        }

        $menuItem = $this->menu->findAllowedController('track', 'show-track');
        if ($menuItem instanceof \Gems_Menu_SubMenuItem) {
            if (!$this->request) {
                $this->request = \Zend_Controller_Front::getInstance()->getRequest();
            }
            $href = $menuItem->toHRefAttribute([
                'gr2t_id_respondent' => $value->getPatientNumber(),
                'gr2t_id_organization' => $value->getOrganizationId(),
                'gr2t_id_respondent_track' => $value->getRespondentTrackId(),
            ], $this->request);
            if ($href) {
                return \MUtil_Html::create('a', $href, $name);
            }
        }

        return $name;
    }
207142
public function resolveRouteBinding($value)
    {
        $id = $this->getOptimus()->decode($value);

        return $this->where($this->getRouteKeyName(), '=', $id)->first();
    }
1065474
protected function getOperationValue($value) {
        
        if(is_a($value, '\\oat\\search\\base\\QueryBuilderInterface')) {
            $serialyser = new self();
            $serialyser->setDriverEscaper($this->getDriverEscaper())->setServiceLocator($this->getServiceLocator())->setOptions($this->getOptions());
            $value = $serialyser->setCriteriaList($value)->prefixQuery()->serialyse();
        }
        return $value;
    }
1233824
public static function findByUsernameOrEmail($value)
    {
        if ($user = static::findByUsername($value)) {
            return $user;
        }

        if ($user = static::findByEmail($value)) {
            return $user;
        }

        return null;
    }
526705
public static function getType($value)
    {
        if (preg_match(self::REGEXP_TCP, $value)) {
            return self::TYPE_TCP;
        }

        if (preg_match(self::REGEXP_SSL, $value)) {
            return self::TYPE_SSL;
        }

        if (preg_match(self::REGEXP_UNIX, $value)) {
            return self::TYPE_UNIX;
        }

        return null;
    }
51048
public function setModelAttribute($value)
    {
        $value = ! empty($value) ? array_map(function ($date) {
            return Carbon::createFromFormat($this->getPickerFormat(), $date);
        }, explode('::', $value)) : null;

        parent::setModelAttribute($value);
    }
185638
protected function createRoute($value)
    {
        if ($value instanceof Route) {
            return $value;
        }
        
        if (is_array($value)) {
            $value = (object)$value;
        }
        
        if (is_object($value) && is_callable($value)) {
            $value = (object)['fn' => $value];
        }
        
        if (!$value instanceof \stdClass) {
            throw new \InvalidArgumentException("Unable to create a Route from value " . var_export($value, true));
        }
        
        return new Route($value);
    }
243104
public function getModel($model = null)
    {
        if ($model === null) {
            $model = $this->crudApi->model;
        }

        if ($model === null) {
            return false;
        }

        // Make Sure model name is uppercased.
        $model = ucfirst($model);

        // If namespace is not detected or set then set to the laravel default of App.
        if ($this->crudApi->namespace === null) {
            $this->crudApi->setNamespace('App\\');
        }


        // Test conventional namespace model combinations
        $conventions = [
            $this->crudApi->namespace . $model,
            $this->crudApi->namespace . 'Models\\' . $model
        ];

        foreach ($conventions as $fqModel) {
            if (class_exists($fqModel)) {
                return $fqModel;
            }
        }

        try {
            // If not conventional, try configurable
            $additionalNamespaces = $this->getAdditionalNamespaces();
            if (!empty($additionalNamespaces)) {
                foreach ($additionalNamespaces as $ns) {
                    $fqModel = $ns . $model;
                    if (class_exists($fqModel)) {
                        return $fqModel;
                    }
                }
            }
        } catch (\Exception $e) {
            return false;
        }

        return false;
    }
1308420
public function getCodeAttribute($value)
    {
        if ($this->active) {
            return $this->details()->active()->first()->code;
        }
        return null;
    }
454265
protected function receiveTokenFieldValueFromRequest($value = null)
    {
        $requestQueryParameter = $this->getRequest()->getQueryParams();
        $requestBody           = $this->getRequest()->getParsedBody();
        $fieldname             = $this->getFieldnameToken();

        if (true === isset($requestQueryParameter[$fieldname])) {
            $value = $requestQueryParameter[$fieldname];
        } elseif (true === isset($requestBody[$fieldname])) {
            $value = $requestBody[$fieldname];
        }

        return $value;
    }
164169
public function get($key, $value = null)
    {
        return $this->queryBag->key($key, $value, true);
    }
195788
public function reverseTransform($value)
    {
        return null !== $value && !empty($value)
            ? $this->contentTypeService->loadContentTypeByIdentifier($value)
            : null;
    }
120372
public function defaultModel($model = null)
    {
        if ($model !== null) {
            $this->_defaultModel = $model;
        }
        if ($this->_defaultModel) {
            return $this->_defaultModel;
        }
        if (!$this->_View->getRequest()->getParam('paging')) {
            return null;
        }
        list($this->_defaultModel) = array_keys($this->_View->getRequest()->getParam('paging'));

        return $this->_defaultModel;
    }
723443
protected function serializeObject($value)
    {
        if ($value instanceof Collection) {
            return $this->serializeEloquentCollection($value);
        }

        if ($value instanceof Paginator) {
            return $this->serializeEloquentPaginatedResource($value);
        }

        if (\is_subclass_of($value, Model::class, true)) {
            return $this->serializeEloquentModel($value);
        }

        return parent::serializeObject($value);
    }
740429
public function getDepartmentAttribute($value)
    {
        if ($this->active) {
            return Department::findOrFail(($this->details()->active()->first()->department_id));
        }
        return null;
    }
123139
public function where($key, $value=null)
    {
        if($value)
            return $this->model->where($key, $value);
        if(is_array($key))
            return $this->model->where($key);
        return null;
    }