Revision 244 | Revision 263 | Zur aktuellen Revision | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed
<?phpnamespace App\Console\Commands;use App\Models\Directory;use Illuminate\Console\Command;use Illuminate\Support\Facades\DB;class convertDB extends Command{/*** The name and signature of the console command.** @var string*/protected $signature = 'command:convertDB';/*** The console command description.** @var string*/protected $description = 'Converts the old webanOS-DB to laravel';/*** Execute the console command.** @return int*/public function handle(){$sql = 'SELECT*FROMdirectory';$dirs = DB::connection('old')->select($sql);foreach ($dirs as $row){//var_dump($row);Directory::factory()->createQuietly(["id" => $row->ID,"directory_id" => $row->Father,"name" => $row->Name,"status" => $row->status,"kennung" => $row->Kennung,"description" => $row->Beschreibung,"short_line_1" => $row->short_line_1,"url" => $row->url,"created_at" => $row->erstellt_am,"updated_at" => $row->letzte_Aenderung_am,]);}}}