src/Database/Builder.php
public function findOrNew($id, $columns = ['*'])
    {
        if (!is_null($model = $this->find($id, $columns))) {
            return $model;
        }

        $attributes = $this->toBase()->getConnection()->getSchemaBuilder()->getColumnListing($this->model->getTable());

        return $this->model->newInstance(array_fill_keys(array_values($attributes), null))->setConnection(
            $this->toBase()->getConnection()->getName()
        );
    }
public function findOrNew($id, $columns = ['*'])
    {
        if (!is_null($model = $this->find($id, $columns))) {
            return $model;
        }

        $attributes = $this->toBase()->getConnection()->getSchemaBuilder()->getColumnListing($this->model->getTable());

        return $this->model->newInstance(array_fill_keys(array_values($attributes), null))->setConnection(
            $this->toBase()->getConnection()->getName()
        );
    }
Find a model by its primary key or return fresh model instance
with filled attributes to use with forms.

@param  mixed $id
@param  array $columns

@return \Illuminate\Database\Eloquent\Model