Skip to content

Commit

Permalink
Merge branch 'develop' into refactor-forms-hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
ilestis committed Jun 7, 2024
2 parents 0821d96 + f632787 commit bcef031
Show file tree
Hide file tree
Showing 16 changed files with 2 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public function index(Campaign $campaign)
/** @var Entity|null $entity */
$entity = Entity::where(['name' => request()->term, 'campaign_id' => $campaign->id])->first();
if ($entity) {
// @phpstan-ignore-next-line
$term2 = $entity->type() . ':' . $entity->id;
}

Expand Down
1 change: 0 additions & 1 deletion app/Http/Controllers/Entity/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public function index(Campaign $campaign, Entity $entity)
{
$this->authEntityView($entity);

// @phpstan-ignore-next-line
if (!view()->exists('entities.pages.profile._' . $entity->type())) {
return redirect()->to($entity->url());
}
Expand Down
1 change: 0 additions & 1 deletion app/Http/Controllers/Entity/TransformController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public function index(Campaign $campaign, Entity $entity)

$entities = $this->typeService
->campaign($campaign)
// @phpstan-ignore-next-line
->exclude([$entity->type(), 'bookmark', 'relation'])
->add(['' => __('entities/transform.fields.select_one')])
->get();
Expand Down
1 change: 0 additions & 1 deletion app/Http/Controllers/Search/FullTextController.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public function index(Campaign $campaign, Request $request)
/** @var Entity|null $entity */
$entity = Entity::where('name', $term)->first();
if ($entity) {
// @phpstan-ignore-next-line
$term2 = $entity->type() . ':' . $entity->id;
}

Expand Down
1 change: 0 additions & 1 deletion app/Http/Resources/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public function toArray($request)
'image_thumb' => Avatar::entity($model)->size(40)->thumbnail(),
'has_custom_image' => !empty($model->image_path) && !empty($model->image),

// @phpstan-ignore-next-line
'type' => $model->type(),
'type_id' => $model->type_id,
'tooltip' => $model->tooltip,
Expand Down
2 changes: 0 additions & 2 deletions app/Http/Resources/EntityResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public function toArray($request)
$data = [
'id' => $entity->id,
'name' => $entity->name,
// @phpstan-ignore-next-line
'type' => $entity->type(),
'type_id' => $entity->type_id,
'child_id' => $entity->entity_id,
Expand Down Expand Up @@ -110,7 +109,6 @@ public function toArray($request)

// Get the actual model
if ($this->withMisc) {
// @phpstan-ignore-next-line
$className = 'App\Http\Resources\\' . ucfirst($entity->type()) . 'Resource';
if (class_exists($className)) {
$obj = new $className($entity->child);
Expand Down
4 changes: 1 addition & 3 deletions app/Models/Concerns/Orderable.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ trait Orderable
*/
public function scopeOrder(Builder $query, array|null $data)
{
// Default
// @phpstan-ignore-next-line
// Default values can be defined on the model, or default
$field = $this->defaultOrderField ?: 'name';
// @phpstan-ignore-next-line
$direction = $this->defaultOrderDirection ?: 'asc';

if (!empty($data) && auth()->check()) {
Expand Down
4 changes: 0 additions & 4 deletions app/Models/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ public function child()
} elseif ($this->isDiceRoll()) {
return $this->diceRoll();
}
// @phpstan-ignore-next-line
return $this->{$this->type()}();
}

Expand All @@ -151,7 +150,6 @@ public function reloadChild()
} elseif ($this->isDiceRoll()) {
return $this->load('diceRoll');
}
// @phpstan-ignore-next-line
return $this->load($this->type());
}

Expand Down Expand Up @@ -224,7 +222,6 @@ public function pluralType(): string
if ($this->cachedPluralName !== false) {
return $this->cachedPluralName;
}
// @phpstan-ignore-next-line
return $this->cachedPluralName = Str::plural($this->type());
}

Expand All @@ -238,7 +235,6 @@ public function typeId()

public function entityType(): string
{
// @phpstan-ignore-next-line
return __('entities.' . $this->type());
}

Expand Down
1 change: 0 additions & 1 deletion app/Models/PluginVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,6 @@ protected function prepareBladeData(Entity $entity): array
$data['_locale'] = app()->getLocale();
$data['_entity_name'] = $entity->name;
$data['_entity_type'] = $entity->child->type;
// @phpstan-ignore-next-line
$data['_entity_type_name'] = $entity->type();

if ($entity->isCharacter()) {
Expand Down
1 change: 0 additions & 1 deletion app/Renderers/DatagridRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ private function renderRow(Model $model): string

$html = '<tr data-id="' . $model->id . '" '
. (!empty($model->type) ? 'data-type="' . Str::slug($model->type) . '" ' : null)
// @phpstan-ignore-next-line
. ($useEntity ? 'data-entity-id="' . $model->entity->id . '" data-entity-type="' . $model->entity->type() . '"' : null);
/*if (!empty($this->options['row']) && !empty($this->options['row']['data'])) {
foreach ($this->options['row']['data'] as $name => $data) {
Expand Down
2 changes: 0 additions & 2 deletions app/Services/Entity/Connections/MapService.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ protected function withEntity(bool $with = true): self
*/
public function map(): array
{
// @phpstan-ignore-next-line
$entityHook = 'init' . ucfirst($this->entity->type());
if (method_exists($this, $entityHook)) {
$this->$entityHook();
Expand Down Expand Up @@ -672,7 +671,6 @@ protected function addParent(): self
{
if (!method_exists($this->entity->child, 'getParentKeyName')) {
// If not part of the node model, check for the {self}_id attribute
// @phpstan-ignore-next-line
if (!array_key_exists($this->entity->type() . '_id', $this->entity->child->getAttributes())) {
return $this;
}
Expand Down
1 change: 0 additions & 1 deletion app/Services/Entity/ExportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public function entity(Entity $entity): self
*/
public function json()
{
// @phpstan-ignore-next-line
$child = Str::studly($this->entity->type());
$className = 'App\Http\Resources\\' . $child . 'Resource';

Expand Down
2 changes: 0 additions & 2 deletions app/Services/Images/AvatarService.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,8 @@ protected function fallbackThumbnail(): string
}

$cloudfront = config('filesystems.disks.cloudfront.url');
// @phpstan-ignore-next-line
if ($this->campaign->boosted() && Arr::has(CampaignCache::defaultImages(), $this->entity->type())) {
$url = Img::crop($this->width, $this->height)
// @phpstan-ignore-next-line
->url(CampaignCache::defaultImages()[$this->entity->type()]);
return $this->return($url);
} elseif (auth()->check() && auth()->user()->isGoblin()) {
Expand Down
1 change: 0 additions & 1 deletion app/Services/MentionsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,6 @@ protected function replaceEntityMentions(): void
$replace = '<a href="' . $url . '"'
. ' class="' . implode(' ', $cssClasses) . '"'
. ' data-entity-tags="' . implode(' ', $tagClasses) . '"'
// @phpstan-ignore-next-line
. ' data-entity-type="' . $entity->type() . '"'
. ' data-toggle="tooltip-ajax"'
. ' data-id="' . $entity->id . '"'
Expand Down
1 change: 0 additions & 1 deletion app/Services/Search/RecentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ protected function formatForLookup(Entity $entity): array
'is_private' => $entity->is_private,
'image' => Avatar::entity($entity)->fallback()->size(64)->thumbnail(),
'link' => $entity->url(),
// @phpstan-ignore-next-line
'type' => Module::singular($entity->typeId(), __('entities.' . $entity->type())),
'preview' => route('entities.preview', [$this->campaign, $entity]),
];
Expand Down
4 changes: 1 addition & 3 deletions app/Services/SearchService.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public function find()
'image' => $img,
'name' => $parsedName,
'type' => Module::singular($model->type_id, $model->entityType()),
'model_type' => $model->type(), // @phpstan-ignore-line
'model_type' => $model->type(),
'url' => $model->url(),
'alias_id' => $model->alias_id, // @phpstan-ignore-line
'advanced_mention' => Mentions::advancedMentionHelper($model->name),
Expand All @@ -297,7 +297,6 @@ public function find()
'image' => $img,
'name' => $parsedName,
'type' => __('maps.actions.explore'),
// @phpstan-ignore-next-line
'model_type' => $model->type(),
'url' => $model->url('explore'),
'alias_id' => $model->alias_id, // @phpstan-ignore-line
Expand Down Expand Up @@ -395,7 +394,6 @@ protected function formatForLookup(Entity $entity): array
'is_private' => $entity->is_private,
'image' => Avatar::entity($entity)->fallback()->size(64)->thumbnail(),
'link' => $entity->url(),
// @phpstan-ignore-next-line
'type' => Module::singular($entity->typeId(), __('entities.' . $entity->type())),
'preview' => route('entities.preview', [$this->campaign, $entity]),
];
Expand Down

0 comments on commit bcef031

Please sign in to comment.