Code cleanup.

This commit is contained in:
James Cole
2023-12-20 19:35:52 +01:00
parent c4f6366642
commit 64ec0cf62e
997 changed files with 12908 additions and 28136 deletions

View File

@@ -33,18 +33,12 @@ use Illuminate\Support\Collection;
*/
class ALERepository implements ALERepositoryInterface
{
/**
* @inheritDoc
*/
public function getForObject(Model $model): Collection
{
// all Models have an ID.
return AuditLogEntry::where('auditable_id', $model->id)->where('auditable_type', get_class($model))->get(); // @phpstan-ignore-line
}
/**
* @inheritDoc
*/
public function store(array $data): AuditLogEntry
{
$auditLogEntry = new AuditLogEntry();
@@ -55,6 +49,7 @@ class ALERepository implements ALERepositoryInterface
$auditLogEntry->before = $data['before'];
$auditLogEntry->after = $data['after'];
$auditLogEntry->save();
return $auditLogEntry;
}
}

View File

@@ -33,17 +33,7 @@ use Illuminate\Support\Collection;
*/
interface ALERepositoryInterface
{
/**
* @param Model $model
*
* @return Collection
*/
public function getForObject(Model $model): Collection;
/**
* @param array $data
*
* @return AuditLogEntry
*/
public function store(array $data): AuditLogEntry;
}