This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
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
You can do the following to get the last segment:
$segments = Request::segments(); $category = end($segments);
1-2 of 2