Is it possible to pass, somehow, a parameter to a relationship function?

I have currently the following:

```
public function achievements()
{
     return $this->belongsToMany('Achievable', 'user_achievements')->withPivot('value', 'unlocked_at')->orderBy('pivot_unlocked_at', 'desc');
}

```

The problem is that, in some cases, it does not fetch the unlocked\_at column and it returns an error.

I have tried to do something like:

```
public function achievements($orderBy = true)
{
$result = $this->belongsToMany (...)
if($orderBy) return $result->orderBy(...)
return $result;
}

```

And call it as:

```
$member->achievements(false)->(...)

```

But this does not work. Is there a way to pass parameters into that function or any way to check if the `pivot_unlocked_at` is being used?