$this->addField('fluidbook', FluidbookID::class, __('Fluidbook'));
$this->addField('type', Integer::class, __('Type'));
$this->addField('data', Text::class, __('Détails'));
+ $this->addField('count', Integer::class, __('Nombre d\'occurences'));
}
public static function addIssue($fluidbookId, $type, $data = '')
$issue = self::withoutGlobalScopes()->where('fluidbook', $fluidbookId)->where('type', $type)->where('data', $data)->first();
if (!$issue) {
- $issue = new self(['fluidbook' => $fluidbookId, 'type' => $type, 'data' => $data]);
+ $issue = new self(['fluidbook' => $fluidbookId, 'type' => $type, 'data' => $data, 'count' => 0]);
}
- $issue->updateTimestamps();
+ $issue->count++;
$issue->save();
}
}