Created
May 3, 2023 12:58
-
-
Save sonichandni/b1a70415f40e4fd0298667184ff80204 to your computer and use it in GitHub Desktop.
Download user logo from user mobile number csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function test() { | |
$csv = \File::get(storage_path().'/app/public/mobile_data_id.csv'); | |
$rows = str_getcsv($csv, "\n"); | |
// Loop through each row | |
foreach ($rows as $mobileNumber) { | |
// Find user ID based on mobile number | |
$userId = \DB::table('client')->where('mobile', $mobileNumber)->value('id'); | |
// Fetch logo image based on user ID TestLogoDir | |
$logoImage = \DB::table('user_biz')->where('user_id', $userId)->value('logo_img'); | |
if(!empty($logoImage)) { | |
$url = CommonFunction::get_file_ad('public/flyer_image/business_logo', $logoImage); | |
// Download logo image | |
$path = "TestLogoDir/$mobileNumber/$logoImage"; | |
Storage::disk('local')->put($path, file_get_contents($url)); | |
} else { | |
echo '<pre>'; print_r($mobileNumber); | |
echo '<pre>'; print_r($userId); | |
} | |
} | |
exit(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment