public function getModel($id = 0, array $fields, array $columns)
    {
        //if we're getting an existing model, we'll want to first get the edit fields without the relationships loaded
        $originalModel = $model = $this->getDataModel();

        //get the model by id
        $model = $model->find($id);
        $model = $model ? $model : $originalModel;

        //if the model exists, load up the existing related items
        if ($model->exists) {
            $this->setExtraModelValues($fields, $model);
        }

        return $model;
    }
public function getModel($id = 0, array $fields, array $columns)
    {
        //if we're getting an existing model, we'll want to first get the edit fields without the relationships loaded
        $originalModel = $model = $this->getDataModel();

        //get the model by id
        $model = $model->find($id);
        $model = $model ? $model : $originalModel;

        //if the model exists, load up the existing related items
        if ($model->exists) {
            $this->setExtraModelValues($fields, $model);
        }

        return $model;
    }
public function getModel ( $ id = 0 , array $ fields , array $ columns ) { //if we're getting an existing model, we'll want to first get the edit fields without the relationships loaded $ originalModel = $ model = $ this -> getDataModel ( ) ; //get the model by id $ model = $ model -> find ( $ id ) ; $ model = $ model ? $ model : $ originalModel ; //if the model exists, load up the existing related items if ( $ model -> exists ) { $ this -> setExtraModelValues ( $ fields , $ model ) ; } return $ model ; }
Gets a model given an id.

@param id    $id
@param array $fields
@param array $columns

@return \Illuminate\Database\Eloquent\Model
Gets a model given an id .