• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

api-platform / core / 18089937549

29 Sep 2025 07:56AM UTC coverage: 21.764% (-0.3%) from 22.093%
18089937549

Pull #7416

github

web-flow
Merge 061bcc790 into abe0438be
Pull Request #7416: fix(laravel): serializer attributes on Eloquent methods

0 of 151 new or added lines in 11 files covered. (0.0%)

5028 existing lines in 173 files now uncovered.

11889 of 54626 relevant lines covered (21.76%)

25.32 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Laravel/workbench/app/Models/BookWithRelation.php
1
<?php
2

3
/*
4
 * This file is part of the API Platform project.
5
 *
6
 * (c) Kévin Dunglas <dunglas@gmail.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

12
declare(strict_types=1);
13

14
namespace Workbench\App\Models;
15

16
use ApiPlatform\Metadata\ApiProperty;
17
use ApiPlatform\Metadata\ApiResource;
18
use ApiPlatform\Metadata\Get;
19
use Illuminate\Database\Eloquent\Factories\HasFactory;
20
use Illuminate\Database\Eloquent\Model;
21
use Illuminate\Database\Eloquent\Relations\BelongsTo;
22
use Symfony\Component\Serializer\Annotation\Groups;
23

24
#[ApiResource(
NEW
25
    operations: [
×
NEW
26
        new Get(normalizationContext: ['groups' => ['book:read']]),
×
NEW
27
    ]
×
NEW
28
)]
×
29
#[ApiProperty(property: 'title', serialize: [new Groups(['book:read'])])]
30
class BookWithRelation extends Model
31
{
32
    use HasFactory;
33

34
    protected $table = 'book_with_relations';
35

36
    protected $fillable = [
37
        'title',
38
        'author_with_group_id',
39
    ];
40

41
    #[Groups(['book:read'])]
42
    public function authorWithGroup(): BelongsTo
43
    {
NEW
44
        return $this->belongsTo(AuthorWithGroup::class);
×
45
    }
46
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc