src/Repository.php
public function create($data, $flush = self::FLUSH)
    {
        if ($flush === self::FLUSH) {
            $this->flushModel();
        }

        if (is_callable($data)) {
            $model = $this->model;

            call_user_func($data, $model);

            $model->push();
        } else {
            $model = $this->model->create($data);
        }

        return $model;
    }
public function create($data, $flush = self::FLUSH)
    {
        if ($flush === self::FLUSH) {
            $this->flushModel();
        }

        if (is_callable($data)) {
            $model = $this->model;

            call_user_func($data, $model);

            $model->push();
        } else {
            $model = $this->model->create($data);
        }

        return $model;
    }
public function create ( $ data , $ flush = self :: FLUSH ) { if ( $ flush === self :: FLUSH ) { $ this -> flushModel ( ) ; } if ( is_callable ( $ data ) ) { $ model = $ this -> model ; call_user_func ( $ data , $ model ) ; $ model -> push ( ) ; } else { $ model = $ this -> model -> create ( $ data ) ; } return $ model ; }
Persist a new set of data

@param array|callable $data
@param int $flush
@return Model|Builder
Persist a new set of data