Laravel Object Clone

by Alexis Hope, 17 Apr 2012

Nice little laravel clone function. Extending the base elquent model for your self is generally best practice.

Then you can whack function little helper functions in there like this.

  public function __clone() {

        $clone = new self($this->to_array());

        unset( $clone->id );

        $clone->exists = false;

        return $clone;

    }