Skip to content

Commit

Permalink
Merge pull request #3 from Habiba-M-Hamed/feature/setting-package-update
Browse files Browse the repository at this point in the history
update_project_setting_package
  • Loading branch information
ah-mabrouk authored Sep 18, 2024
2 parents 26d4e3d + 4c3ff8b commit 1ce3c55
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/Filters/Client/ProjectSettingFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@

class ProjectSettingFilter extends QueryFilter
{
public function of_key($key = '')
public function of_keys($keys = '')
{
return $key ? $this->builder->ofKey($key) : $this->builder;
$keysArray = explode(',', $keys);

return $keys ? $this->builder->ofKeys($keysArray) : $this->builder;
}

public function of_type($typeId = '')
Expand Down
4 changes: 2 additions & 2 deletions src/Http/Resources/Client/ProjectSettingResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ public function toArray($request)
'name' => $this->name,
'value' => $this->when(! \in_array($this->projectSettingType->name, ['phone', 'image']), $this->value),

'translatable' => $this->isTranslatable,
// 'translatable' => $this->isTranslatable,

'phone' => $this->when($this->projectSettingType->name == 'phone', new PhoneResource($this->phone)),
'image' => $this->when($this->projectSettingType->name == 'image', new MediaResource($this->mainImage)),
'type' => new ProjectSettingTypeResource($this->projectSettingType),
'section' => new ProjectSettingSectionSimpleResource($this->projectSettingSection),
// 'section' => new ProjectSettingSectionSimpleResource($this->projectSettingSection),
];
}
}
5 changes: 5 additions & 0 deletions src/Models/ProjectSetting.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ public function scopeOfKey($query, $key = '')
$query->where('key', $key);
}

public function scopeOfKeys($query, array $keys = [])
{
$query->whereIn('key', $keys);
}

public function scopeOfType($query, int $typeId = 0)
{
$query->where('project_setting_type_id', $typeId);
Expand Down

0 comments on commit 1ce3c55

Please sign in to comment.