2017 © Pedro Peláez
 

library eloquentcopy

Provides a simple way to duplicate a model instance

image

lucasmichot/eloquentcopy

Provides a simple way to duplicate a model instance

  • Tuesday, July 8, 2014
  • by lucasmichot
  • Repository
  • 0 Watchers
  • 0 Stars
  • 15 Installations
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

EloquentCopy

Provides a simple way to duplicate a model instance., (*1)

Requirements: * PHP >= 5.4 * Laravel 4.2, (*2)

Package installation

Begin by installing this package through Composer. Edit your project's composer.json file to require lucasmichot/eloquentcopy., (*3)

"require": {
  "lucasmichot/eloquentcopy": "0.*"
}

Next, update Composer from the Terminal:, (*4)

$ composer update

You can achieve these operations with this one-liner command :, (*5)

$ composer require "lucasmichot/eloquentcopy:0.*"

Usage

use Lucasmichot\Eloquentcopy\CopyTrait;

class Post extends Eloquent
{
    use CopyTrait;

    // the code of your model comes here
}

Copying an instance of the model :, (*6)

$firstPost = Post::create([
    'title' => 'Foo',
    'text'  => 'Sample text',
]);

$secondPost = $firstPost->copy();
// $secondPost has no ID, no created_at and no updated_at attribute

$secondPost->save();

TODO

  • [ ] Finish documentation

The Versions

08/07 2014

dev-master

9999999-dev

Provides a simple way to duplicate a model instance

  Sources   Download

MIT

The Requires

 

laravel eloquent copy

08/07 2014

0.1

0.1.0.0

Provides a simple way to duplicate a model instance

  Sources   Download

MIT

The Requires

 

laravel eloquent copy