Skip to content

Commit dc0df21

Browse files
committed
Update dedicated column docs
1 parent b7a2de3 commit dc0df21

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ By default, the Eloquent Driver stores all data in a single `data` column. Howev
109109
php artisan migrate
110110
```
111111

112-
4. If you're adding `json` or `integer` columns, you will need to provide your own `Entry` model in order to set the appropriate casts. You can do this by creating a new model which extends the default `Entry` model:
112+
4. If you're adding a column that [requires an Eloquent cast](https://laravel.com/docs/master/eloquent-mutators#attribute-casting) (eg. a `json` or `integer` column), you will need to provide your own `Entry` model in order to set the appropriate casts. You can do this by creating a new model which extends the default `Entry` model:
113+
113114
```php
114115
<?php
115116

@@ -134,6 +135,19 @@ By default, the Eloquent Driver stores all data in a single `data` column. Howev
134135
```php
135136
class Entry extends \Statamic\Eloquent\Entries\UuidEntryModel
136137
```
138+
139+
Once created, you will need to update the model in the `entries` section of the configuration file:
140+
141+
```php
142+
// config/statamic/eloquent-driver.php
143+
144+
'entries' => [
145+
'driver' => 'file',
146+
'model' => \App\Models\Entry::class, // Your custom Entry model
147+
'entry' => \Statamic\Eloquent\Entries\Entry::class,
148+
'map_data_to_columns' => false,
149+
],
150+
```
137151

138152
5. If you have existing entries, you will need to re-save them to populate the new columns. You can do this by pasting the following snippet into `php artisan tinker`:
139153
```php

0 commit comments

Comments
 (0)