Laravel 5从.csv添加现有表

时间:2016-02-29 11:44:43

标签: php database laravel eloquent

我试图将现有表格添加到我的Laravel项目中。我在Scratch的Laravel中使用Sqlite数据库。现在我想用一个.csv转换的excel表中的现有数据向我的Sqlite数据库添加另一个表。

我使用Sqlite Studio编辑了我的Sqlite数据库,并正确添加了表格。然而,当我进入Laravel并做>>> class Countries(object): ... def __init__(self, country_capital, country_population): ... self.capital = country_capital ... self.population = country_population ... >>> france = Countries("Paris", "66") >>> england = Countries("London", "53") >>> usa = Countries("Washington, DC", "318") >>> germany = Countries("Berlin", "80") >>> [c.capital for c in sorted([france, england, usa, germany], key=lambda c: int(c.population))] ['London', 'Paris', 'Berlin', 'Washington, DC'] 时,它说没有这样一个名字的桌子......怎么样?因为它在Sqlite工作室中清楚地显示出来。

我在这里错过了什么吗?

1 个答案:

答案 0 :(得分:0)

好吧,显然,由于你没有"保存"文件。因此,扩展程序将我的版本与远程版本进行比较,但没有看到更改。远程删除文件然后再次上传它。

相关问题