Query Scope distinct

Is there a way to create a filter that filters out empty and duplicate entries and returns them? My previous attempt:

frontend:

<select id="application-industrie" name="industrie" class="form-control custom-select">
                        {{ collection from="jobs" query_scope="unique_filter" }}
                        <option value="">{{{ department }}</option>
                        {{ /collection }}
                    </select>

Backend:

class UniqueFilter extends Scope
{
    public function apply($query, $values)
    {
        $query->where('department', '!=', null)->orderBy('department', 'asc')->get();
    }
}
>>>>>>> Unanswered <<<<<<<
0 Replies
1 Follower