Hello rambod256,
If the device was erased and the photos were not being synced by iCloud or stored in an iCloud/computer backup then there would not be a way of recovering them unfortunately.
While it may not be of assistance for this moment, this page can help to provide info on setting up iCloud Photos to help prevent similar incidents for the future: Set up and use iCloud Photos - Apple Support
Alternatively this page can help with setting up automatic iCloud backups: How to back up your iPhone or iPad with iCloud - Apple Support
Automatically back up with iCloud Backup
1. Go to Settings > [your name] > iCloud > iCloud Backup and make sure that Back Up This [Device] is turned on.
2. Connect your device to a power source.
3. Connect your device to a Wi-Fi network.
4. Make sure that your device's screen is locked.
5. If you get an alert that you don't have enough iCloud storage space to complete the backup, follow the onscreen steps to buy more iCloud storage.
Take care.