Skip to content

Commit

Permalink
Add missing Relationship Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
marcreichel committed Jan 12, 2019
1 parent 89d7ca5 commit dc28306
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,22 @@ instead use `findOrFail`. This will throw an
`MarcReichel\IGDBLaravel\Exceptions\ModelNotFoundException` if no result were
found.

#### Relationships (Extends)

To extend your result use the `with`-method:

```php
$game = Game::with(['cover', 'artworks'])->get();
```

By default, every field (`*`) of the relationship is selected.
If you want to define the fields of the relationship yourself you have to define
the relationship as the array-key and the fields as an array:

```php
$game = Game::with(['cover' => ['url', 'image_id'])->get();
```

### Reading properties

#### Model-based approach
Expand Down

0 comments on commit dc28306

Please sign in to comment.