The problem is the param is not available in this scope? What can I do? Or is there a easier way?
So to be clear I wanna get an article with a specific slug in relation with a specific coin.
If you want to use variables from outside a closure, you must use them:
$article = Coin::where('name', '=', $coin)
->whereHas('articles', function ($query) use ($slug) { // this line
$query->where('slug', '=', $slug);
})->get();