📄 update-brands.php
📁 Path: /home/skhata/chandrasons.com/update-brands.php
📊 Size: 5.91 KB
🔒 Perm: 0644
📝 MIME: text/x-php
<?php
/**
* Run this once from the project root to update brand logo paths in the DB:
* php update-brands.php
*
* Safe to run multiple times — uses updateOrCreate logic.
*/
require __DIR__ . '/vendor/autoload.php';
$app = require_once __DIR__ . '/bootstrap/app.php';
$app->make(\Illuminate\Contracts\Console\Kernel::class)->bootstrap();
use Illuminate\Support\Facades\DB;
$brands = [
['name' => 'Sun Pharma', 'logo_path' => 'brands/sun-pharma.svg', 'website_url' => 'https://www.sunpharma.com'],
['name' => 'Cipla', 'logo_path' => 'brands/cipla.svg', 'website_url' => 'https://www.cipla.com'],
['name' => "Dr. Reddy's Laboratories", 'logo_path' => 'brands/dr-reddys.svg', 'website_url' => 'https://www.drreddys.com'],
['name' => 'Lupin Pharmaceuticals', 'logo_path' => 'brands/lupin.svg', 'website_url' => 'https://www.lupin.com'],
['name' => 'Abbott India', 'logo_path' => 'brands/abbott-india.svg', 'website_url' => 'https://www.abbott.co.in'],
['name' => 'Mankind Pharma', 'logo_path' => 'brands/mankind-pharma.svg', 'website_url' => 'https://www.mankindpharma.com'],
['name' => 'Alkem Laboratories', 'logo_path' => 'brands/alkem-laboratories.svg', 'website_url' => 'https://www.alkemlabs.com'],
['name' => 'Torrent Pharmaceuticals', 'logo_path' => 'brands/torrent-pharmaceuticals.svg', 'website_url' => 'https://www.torrentpharma.com'],
['name' => 'Zydus Lifesciences', 'logo_path' => 'brands/zydus-lifesciences.svg', 'website_url' => 'https://www.zyduslife.com'],
['name' => 'Intas Pharmaceuticals', 'logo_path' => 'brands/intas-pharmaceuticals.svg', 'website_url' => 'https://www.intaspharma.com'],
['name' => 'GSK India', 'logo_path' => 'brands/gsk-india.svg', 'website_url' => 'https://in.gsk.com'],
['name' => 'Pfizer India', 'logo_path' => 'brands/pfizer-india.svg', 'website_url' => 'https://www.pfizer.co.in'],
['name' => 'Novartis India', 'logo_path' => 'brands/novartis-india.svg', 'website_url' => 'https://www.novartis.in'],
['name' => 'Sanofi India', 'logo_path' => 'brands/sanofi-india.svg', 'website_url' => 'https://www.sanofi.in'],
['name' => 'Aurobindo Pharma', 'logo_path' => 'brands/aurobindo-pharma.svg', 'website_url' => 'https://www.aurobindo.com'],
['name' => 'IPCA Laboratories', 'logo_path' => 'brands/ipca-laboratories.svg', 'website_url' => 'https://www.ipca.com'],
['name' => 'Glenmark Pharmaceuticals', 'logo_path' => 'brands/glenmark-pharmaceuticals.svg', 'website_url' => 'https://www.glenmarkpharma.com'],
['name' => 'Biocon', 'logo_path' => 'brands/biocon.svg', 'website_url' => 'https://www.biocon.com'],
['name' => 'Micro Labs', 'logo_path' => 'brands/micro-labs.svg', 'website_url' => 'https://www.microlabsltd.com'],
['name' => 'Elder Pharmaceuticals', 'logo_path' => 'brands/elder-pharmaceuticals.svg', 'website_url' => 'https://www.elderpharmaceuticals.com'],
['name' => 'Himalaya Drug Company', 'logo_path' => 'brands/himalaya-drug-company.svg', 'website_url' => 'https://www.himalayawellness.in'],
['name' => 'Dabur Pharmaceuticals', 'logo_path' => 'brands/dabur.svg', 'website_url' => 'https://www.dabur.com'],
['name' => 'Emami Limited', 'logo_path' => 'brands/emami.svg', 'website_url' => 'https://www.emamiltd.in'],
['name' => 'Wockhardt', 'logo_path' => 'brands/wockhardt.svg', 'website_url' => 'https://www.wockhardt.com'],
['name' => 'Natco Pharma', 'logo_path' => 'brands/natco-pharma.svg', 'website_url' => 'https://www.natcopharma.co.in'],
['name' => 'Hetero Healthcare', 'logo_path' => 'brands/hetero-healthcare.svg', 'website_url' => 'https://www.heterohealthcare.com'],
['name' => 'Strides Pharma', 'logo_path' => 'brands/strides-pharma.svg', 'website_url' => 'https://www.strides.com'],
['name' => 'Eris Lifesciences', 'logo_path' => 'brands/eris-lifesciences.svg', 'website_url' => 'https://www.erislife.com'],
['name' => 'Procter & Gamble Health', 'logo_path' => 'brands/pg-health.svg', 'website_url' => 'https://www.pghealth.in'],
['name' => 'Reckitt Benckiser India', 'logo_path' => 'brands/reckitt-benckiser.svg', 'website_url' => 'https://www.rb.com/india'],
];
$updated = 0;
$inserted = 0;
foreach ($brands as $i => $brand) {
$existing = DB::table('brand_partners')->where('name', $brand['name'])->first();
if ($existing) {
DB::table('brand_partners')->where('name', $brand['name'])->update([
'logo_path' => $brand['logo_path'],
'website_url' => $brand['website_url'],
'sort_order' => $i + 1,
'is_active' => 1,
'updated_at' => now(),
]);
echo " Updated: {$brand['name']}\n";
$updated++;
} else {
DB::table('brand_partners')->insert([
'name' => $brand['name'],
'logo_path' => $brand['logo_path'],
'website_url' => $brand['website_url'],
'sort_order' => $i + 1,
'is_active' => 1,
'created_at' => now(),
'updated_at' => now(),
]);
echo " Inserted: {$brand['name']}\n";
$inserted++;
}
}
// Clear settings cache so logos show immediately
DB::table('cache')->where('key', 'like', 'setting_%')->delete();
echo "\nDone! Updated: $updated, Inserted: $inserted\n";
echo "Brand logos are now live.\n";