This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

RedMarlin
RedMarlin

Im trying to add sorting option in the backend for questions in my Redmarlin.Faq plugin. I want to modify reorder query to show only questions from given category.
Im passing the category id in url: backend/redmarlin/faq/faq/reorder/{catid}
Now, to retrieve the category id and modify the query I do the following:

public function reorderExtendQuery($query)
    {
            $segment = Request::segment(6);
            $query->where('category_id', $segment);         
    }

The above does work but Im pretty sure that there should be a better way to achieve it.
I was going through documentation but couldnt find anything relevant.

Last updated

autumn
autumn

You can do the following to get the last segment:

$segments = Request::segments(); $category = end($segments);

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.