Relationship manager not showing attribute.

Hello guys, i have a relationship manager that is not showing a property of the relation, but shows correctly the number of entities in the table. Below is the relationship manager class since i cannot post it here.
3 Replies
Jocka
JockaOP5d ago
Jocka
JockaOP5d ago
And here is the CourseBundle model
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;

class CourseBundle extends Model
{
use HasFactory;

protected $guarded = ['id'];

public function courses(): BelongsToMany
{
return $this->belongsToMany(Course::class, 'course_course_bundles', 'course_bundle_id', 'course_id')
->withTimestamps();
}
}
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;

class CourseBundle extends Model
{
use HasFactory;

protected $guarded = ['id'];

public function courses(): BelongsToMany
{
return $this->belongsToMany(Course::class, 'course_course_bundles', 'course_bundle_id', 'course_id')
->withTimestamps();
}
}
when i dd this in the resource
dd(CourseBundle::with('courses')->get()->toArray());
dd(CourseBundle::with('courses')->get()->toArray());
Jocka
JockaOP5d ago
No description
Want results from more Discord servers?
Add your server