Create method in Laravel
淡淡烟草味
淡淡烟草味 2017-05-31 10:34:25
0
2
456
$save['title']=$rv['title'];
$save['url']='http://pan.baidu.com';
Ukcont::create($save);

The above is my method of creating new data, using the Ukcont table.

The picture below shows the error message:

I’m a little confused, why is it ukconts? The model I created is also ukcont, and the data table is also ukcont. Ask for advice.

淡淡烟草味
淡淡烟草味

reply all(2)
世界只因有你

Table name

Note that we didn’t tell Eloquent which table to use for our Flight
model. The default rule is that the plural of the model class name is used as the corresponding table name, unless another name is explicitly specified in the model class. So, in this case, Eloquent thinks the
Flight model stores records in the flights table. You can also define the table attribute in the model to specify a custom table name:

Reference: http://laravelacademy.org/pos...

黄舟

Laravel is a very elegant framework. How elegant is it? Be elegant enough that your table names, by default, are the plural form of your models. So if you don't name it according to this, then you must specify the table name in the model.

protected $table = 'ukcount';
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template