use Illuminate\Database\Eloquent\Relations\MorphTo;
/**
- * @property int $id
- * @property int $deleted_by
- * @property string $deletable_type
- * @property int $deletable_id
+ * @property int $id
+ * @property int $deleted_by
+ * @property string $deletable_type
+ * @property int $deletable_id
* @property Deletable $deletable
*/
class Deletion extends Model implements Loggable
protected function listFormatter(Deletion $deletion)
{
$deletable = $deletion->deletable;
- $withTrashedQuery = fn(Builder $query) => $query->withTrashed();
+ $withTrashedQuery = fn (Builder $query) => $query->withTrashed();
if ($deletable instanceof BookChild) {
$parent = $deletable->getParent();
* Mapping of tables and columns that contain polymorphic types.
*/
protected $columnsByTable = [
- 'activities' => 'entity_type',
- 'comments' => 'entity_type',
- 'deletions' => 'deletable_type',
+ 'activities' => 'entity_type',
+ 'comments' => 'entity_type',
+ 'deletions' => 'deletable_type',
'entity_permissions' => 'restrictable_type',
- 'favourites' => 'favouritable_type',
- 'joint_permissions' => 'entity_type',
- 'search_terms' => 'entity_type',
- 'tags' => 'entity_type',
- 'views' => 'viewable_type',
+ 'favourites' => 'favouritable_type',
+ 'joint_permissions' => 'entity_type',
+ 'search_terms' => 'entity_type',
+ 'tags' => 'entity_type',
+ 'views' => 'viewable_type',
];
/**
'parent' => [
'id' => $page->chapter->id,
'name' => $page->chapter->name,
- 'type' => 'chapter'
- ]
- ]
+ 'type' => 'chapter',
+ ],
+ ],
],
];
$resp = $this->putJson($this->baseEndpoint . '/' . $deletion->id);
$resp->assertJson([
- 'restore_count' => 1
+ 'restore_count' => 1,
]);
$this->assertDatabaseHas('pages', [
$resp = $this->deleteJson($this->baseEndpoint . '/' . $deletion->id);
$resp->assertJson([
- 'delete_count' => 1
+ 'delete_count' => 1,
]);
$this->assertDatabaseMissing('pages', ['id' => $page->id]);