Viewing entries tagged with 'php'

Laravel Object Clone

Posted by Alexis on 17 October 2012 | 0 Comments

Tags:

 

        public function __clone() {
            $clone = new self($this->to_array());
            unset( $clone->id );
            $clone->exists = false;
            return $clone;
        }

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

0 comments | Read the full post