That's because the following query returns a collection of objects and not a string:
$url = DB::table('menus')
->select('parent_id')
->where('url', '=', $param['param'])
->get();
You should do:
$url = DB::table('menus')
->select('parent_id')
->where('url', '=', $param['param'])
->first();
$data = DB::table('menus')
->join('article_categories', 'article_categories.id', '=', 'menus.parent_id')
->where('parent_id', '=', $url->parent_id)
->get();
Or this if you expect multiple results from the first query:
$url = DB::table('menus')
->select('parent_id')
->where('url', '=', $param['param'])
->pluck('parent_id');
$data = DB::table('menus')
->join('article_categories', 'article_categories.id', '=', 'menus.parent_id')
->whereIn('parent_id', $url)
->get();