Example of Pivot tables with extra fields in officelifehq/officelife

File app/Models/Company/Employee.php (link to Github)
use Illuminate\Database\Eloquent\Model;

class Employee extends Model
{
    //
    public function meetings()
    {
        return $this->belongsToMany(Meeting::class)->withTimestamps()->withPivot('was_a_guest', 'attended');
    }
    //
}
File app/Http/ViewHelpers/Company/Group/GroupMeetingsViewHelper.php (link to Github)
use App\Models\Company\Company;
use App\Models\Company\Meeting;

class GroupMeetingsViewHelper
{
    //
    public static function show(Meeting $meeting, Company $company): array
    {
    public static function show(Meeting $meeting, Company $company): array
    {
        $participants = $meeting->employees()
            ->orderBy('last_name', 'asc')
            ->get();

        $participantsCollection = collect([]);
        $guestsCollection = collect([]);
        foreach ($participants as $employee) {
            if ((bool) $employee->pivot->was_a_guest) {
                $guestsCollection->push([
                    'id' => $employee->id,
                    'name' => $employee->name,
                    'avatar' => ImageHelper::getAvatar($employee, 23),
                    'attended' => (bool) $employee->pivot->attended,
                    'was_a_guest' => true,
                    'url' => route('employees.show', [
                        'company' => $company,
                        'employee' => $employee,
                    ]),
                ]);
            } else {
                $participantsCollection->push([
                    'id' => $employee->id,
                    'name' => $employee->name,
                    'avatar' => ImageHelper::getAvatar($employee, 23),
                    'attended' => (bool) $employee->pivot->attended,
                    'was_a_guest' => false,
                    'url' => route('employees.show', [
                        'company' => $company,
                        'employee' => $employee,
                    ]),
                ]);
            }
        }
        //
    }
    //
}