How to get source names website wise from multisource inventory?
I have below code for getting all names from a collection of inventory sources:
use Magento\Inventory\Model\ResourceModel\Source\Collection as InventoryCollection;
public function __construct(
Context $context,
InventoryCollection $inventoryCollection
){
parent::__construct($context);
$this->_inventoryCollection = $inventoryCollection;
}
public function getInventorySources()
{
$sourceListArr = $this->_inventoryCollection->load();
$sourceList=[];
$sourceAllList=[];
$sourceList = array();
foreach ($sourceListArr as $sourceItemName) {
$sourceList['sourceName'] = $sourceItemName->getName();
$sourceAllList[] = $sourceList;
}
return $sourceAllList;
}
It will return all the sources, Here I want to get website wise source names,
How can I achieve this functionality?