seedOldData(); } /** * Seed old data */ public function seedOldData(): void { $mobileCarousels = json_decode(File::get('database/data/carousels.json')); $table = 'carousels'; DB::table($table)->truncate(); try { foreach ($mobileCarousels as $mobileCarousel) { DB::table($table)->insert([ 'id' => $mobileCarousel->id, 'app' => OS::MOBILE_APP, 'place' => $mobileCarousel->place, 'link' => $mobileCarousel->link, 'is_visible' => $mobileCarousel->is_visible, 'resource_id' => $mobileCarousel->banner_resource, 'resource_type' => $mobileCarousel->banner_type, 'sort_order' => $mobileCarousel->sort_order, ]); } } catch (Exception $e) { info(['Ignore error', $e->getMessage()]); } DB::statement(" SELECT setval('{$table}_id_seq', (SELECT MAX(id) from {$table})) "); } }