File: /var/www/ipsremont-demo/app/Console/Commands/SetPngImages.php
<?php
namespace App\Console\Commands;
use App\Models\Schema;
use Illuminate\Console\Command;
class SetPngImages extends Command
{
protected $signature = 'admin:set-png';
public function handle()
{
$schemas = Schema::query()->where('photo', 'LIKE', '%.tif%')->get();
foreach ($schemas as $schema) {
$photo = str_replace('.tiff', '.png', $schema->photo);
$photo = str_replace('.tif', '.png', $photo);
/** @var Schema $schema */
$schema->photo = $photo;
$schema->save();
}
}
}