Skip to content

Commit 9871281

Browse files
committed
Merge pull request #1880 from authman/master
Patch for ->push();
2 parents d1ae232 + 9ba285a commit 9871281

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

laravel/database/eloquent/model.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ public function has_many_and_belongs_to($model, $table = null, $foreign = null,
335335
*/
336336
public function push()
337337
{
338-
$this->save();
338+
if (!$this->save()) return false;
339339

340340
// To sync all of the relationships to the database, we will simply spin through
341341
// the relationships, calling the "push" method on each of the models in that
@@ -349,9 +349,11 @@ public function push()
349349

350350
foreach ($models as $model)
351351
{
352-
$model->push();
352+
if (!$model->push()) return false;
353353
}
354354
}
355+
356+
return true;
355357
}
356358

357359
/**

0 commit comments

Comments
 (0)