How can I grab the Identifier from the URL and pass it to the Model Scope?
I have been stuck on this problem for several days.
URL: localhost/user/Matt/general
Identifiers: /user/:username?/:category?/:page?
In my custom Component or Page, I can get the Identifiers into a varaible using:
$username = $this->param('username'); //Matt (:username?)
$category = $this->param('category'); //general (:category?)
Page
[builderList]
...
scope = "scopeApplyUser"
...
{% component 'builderList' %}
Model
Now how to get it into the Scope to filter results?
// return results that match username and category
public function scopeApplyUser($query, $username = null, $category = null)
{
$params = ['username' => $username, 'category' => $category];
return $query->where($params);
}