You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16-7Lines changed: 16 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -155,10 +155,11 @@ To get started, let's create an model extends `BaseModel` or through `My_model`,
155
155
156
156
### Table Names
157
157
158
-
By convention, the "snake case" with lowercase excluded `_model` postfix of the class name will be used as the table name unless another name is explicitly specified. So, in this case, BaseModel will assume the `Posts_model` model stores records in the `posts` table. You may specify a custom table by defining a table property on your model:
158
+
By convention, the "snake case" with lowercase excluded `_model` postfix of the class name will be used as the table name unless another name is explicitly specified. So, in this case, BaseModel will assume the `Post_model` model stores records in the `post` table. You may specify a custom table by defining a table property on your model:
159
159
160
160
```php
161
-
class Post_model extends BaseModel
161
+
// class My_model extends BaseModel
162
+
class Post_model extends My_model
162
163
{
163
164
protected $table = "post_table";
164
165
}
@@ -178,10 +179,10 @@ In our pattern, The naming between model class and table is the same, with suppo
178
179
179
180
### Primary Keys
180
181
181
-
You may define a protected $primaryKey property to override this convention.
182
+
You may define a protected `$primaryKey` property to override this convention:
182
183
183
184
```php
184
-
class Post_model extends BaseModel
185
+
class My_model extends BaseModel
185
186
{
186
187
protected $primaryKey = "sn";
187
188
}
@@ -387,7 +388,8 @@ class My_model extends BaseModel
387
388
If you need to disabled SOFT DELETED feature for specified model, you may set `SOFT_DELETED` to `false`, which would disable any SOFT DELETED functions including `DELETED_AT` feature:
388
389
389
390
```php
390
-
class My_model extends BaseModel
391
+
// class My_model extends BaseModel
392
+
class Log_model extends My_model
391
393
{
392
394
const SOFT_DELETED = false;
393
395
}
@@ -504,7 +506,7 @@ There are three types to set read & write databases:
504
506
505
507
#### Codeigniter Database Key
506
508
507
-
You could set the database key refering from `\application\config\database.php`to `database` & `databaseRead` attribute, the setting connections would be created automatically:
509
+
You could set the database key refered from `\application\config\database.php`into model attributes of `database` & `databaseRead`, the setting connections would be created automatically:
0 commit comments