i m trying to update a specific pivot model data trought a relation but cant seem to find the correct way to make it work.
my relations are as follow: a company belongToMany Licenses (only a Name attribute). in the pivot data table, i have a ExpiryDate
$company->licenses->each(function($license) {
if ($license->name = 'some value') {
$license->expirydate = new Carbon;
}
});
but this brings an error as the license model does not have a expirydate attribute of course.
then how can we update an existing pivot data model ?