Created
March 16, 2015 23:53
-
-
Save giltotherescue/99ff2c3bda78ab8adea1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$orig = Portfolio::findOrFail(Input::get('copy_portfolio')); | |
$portfolio = $orig->replicate(); | |
$portfolio->title = Input::get('title'); | |
$portfolio->push(); | |
foreach ($orig->authors as $a) | |
{ | |
$portfolio->authors()->attach($a); | |
} | |
foreach ($orig->audiences as $a) | |
{ | |
$new = new Audience(); | |
$new->fill_raw($a); | |
$portfolio->authors()->save($new); | |
} | |
foreach ($orig->editorComment as $a) | |
{ | |
$new = new EditorComment(); | |
$new->fill_raw($a); | |
$portfolio->editorComment()->save($new); | |
} | |
foreach ($orig->uploads as $a) | |
{ | |
$new = new Upload(); | |
$new->fill_raw($a); | |
$portfolio->uploads()->save($new); | |
} | |
$portfolio->save(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment