Skip to content

Commit

Permalink
Update dedicated column docs (#397)
Browse files Browse the repository at this point in the history
* Update dedicated column docs

* wip
  • Loading branch information
duncanmcclean authored Feb 19, 2025
1 parent b7a2de3 commit d333ad2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ By default, the Eloquent Driver stores all data in a single `data` column. Howev
php artisan migrate
```

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:
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:

```php
<?php

Expand All @@ -134,6 +135,13 @@ By default, the Eloquent Driver stores all data in a single `data` column. Howev
```php
class Entry extends \Statamic\Eloquent\Entries\UuidEntryModel
```

Once created, you will need to update the model in the `entries` section of the configuration file:

```diff
- 'model' => \Statamic\Eloquent\Entries\EntryModel::class,
+ 'model' => \App\Models\Entry::class,
```

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`:
```php
Expand Down

0 comments on commit d333ad2

Please sign in to comment.