Skip to content

Commit

Permalink
Merge pull request #9 from Habiba-M-Hamed/feature/display-only-visibl…
Browse files Browse the repository at this point in the history
…e-project-settings-group

return only visible project settings group in admin index
  • Loading branch information
ah-mabrouk authored Dec 15, 2024
2 parents 48d8c31 + 54b17db commit 55384e0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ProjectSettingGroupController extends Controller
public function index(ProjectSettingGroupFilter $filters)
{
$paginationLength = pagination_length(ProjectSettingGroup::class);
$projectSettingGroups = ProjectSettingGroup::filter($filters)->paginate($paginationLength);
$projectSettingGroups = ProjectSettingGroup::visible()->filter($filters)->paginate($paginationLength);
return ProjectSettingGroupResource::collection($projectSettingGroups);
}

Expand Down
5 changes: 5 additions & 0 deletions src/Models/ProjectSettingGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ public function projectSettings()

## Query Scope Methods

public function scopeVisible($query, bool $visible = true)
{
return $query->where('is_visible', $visible);
}

## Other Methods

public function remove()
Expand Down

0 comments on commit 55384e0

Please sign in to comment.