images)->map(function($image) { if (!strpos($image['image'], 'cropped-images')) { return $image; } $n = preg_replace('/-(\d+-){4}\d+/', '', $image['image']); $n = str_replace('cropped-images/', '', $n); if (!\Storage::has('media'.$n)) { return $image; } $image['image'] = $n; return $image; }); $k->update(['images' => $newImages]); } } /** * Get the console command arguments. * @return array */ protected function getArguments() { return []; } /** * Get the console command options. * @return array */ protected function getOptions() { return []; } }