Compare commits

...

2 Commits

Author SHA1 Message Date
philipp lang 547c9edfd5 Update CHANGELOG
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2024-08-25 14:11:18 +02:00
philipp lang 6e09e2ec0d Fix: Show all groups in conditions 2024-08-25 14:10:22 +02:00
3 changed files with 12 additions and 3 deletions

View File

@ -1,5 +1,9 @@
# Letzte Änderungen
### 1.10.18
- Fixed: All Gruppen als Option anbieten bei Bedingungen
### 1.10.17
- Es können nun auch Bedingungen für Felder vom Typ Gruppierung definiert werden

View File

@ -6,6 +6,7 @@ use App\Group;
use App\Group\Resources\GroupResource;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
use Lorisleiva\Actions\ActionRequest;
use Lorisleiva\Actions\Concerns\AsAction;
class GroupApiIndexAction
@ -20,8 +21,12 @@ class GroupApiIndexAction
return Group::get();
}
public function asController(?Group $group = null): AnonymousResourceCollection
public function asController(ActionRequest $request, ?Group $group = null): AnonymousResourceCollection
{
return GroupResource::collection($group ? $group->children()->withCount('children')->get() : Group::where('parent_id', null)->withCount('children')->get());
return GroupResource::collection(
$request->has('all')
? Group::with('children')->get()
: ($group ? $group->children()->withCount('children')->get() : Group::where('parent_id', null)->withCount('children')->get())
);
}
}

View File

@ -176,6 +176,6 @@ if (props.single.links && props.single.links.is_dirty) {
const groupOptions = ref([]);
onMounted(async () => {
groupOptions.value = (await axios.get('/api/group')).data.data;
groupOptions.value = (await axios.get('/api/group?all')).data.data;
});
</script>