Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
libern committed Jul 17, 2017

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 839a393 commit 7aaf231
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -62,11 +62,14 @@ $somelineImage = SomelineImage::find(1);
/** @var User $user */
$user = User::find(1);

// save image relations smartly with sequence support (recommended)
$user->syncImages([1, 2], ['type' => 'cover', 'data' => json_encode('a')]);

// save image relations via save
$user->images()->save($somelineImage, ['type' => 'cover', 'data' => json_encode('a')]);

// save image relations via attach
$user->images()->attach([1], ['type' => 'cover', 'data' => json_encode('a')]);
$user->images()->attach(1, ['type' => 'cover', 'data' => json_encode('a')]);

// update image relations via sync
$user->images()->sync([1]);

0 comments on commit 7aaf231

Please sign in to comment.