Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ This functionality is most suited for meta entries that note exceptions to rules
];
```

> **Note:** Make sure to use lowercase keys.

#### Gotcha

When you extend a model and still want to use the same meta table you must override `getMetaKeyName` function.
Expand Down Expand Up @@ -363,6 +365,10 @@ unset($post->content);// will not unset meta
isset($post->content);// will not check if meta exists
```

#### Using Original `getAttribute` and `setAttribute` Methods

Laravel meta overrides these Laravel methods for fluent access. If you’ve already disabled fluent access using the method above, these methods' behavior won't change. Otherwise, you can use `getAttributeRaw` and `setAttributeRaw` to access the original methods.

#### Retrieving All Metas

To fetch all metas associated with a piece of content, use the `getMeta` without any params
Expand Down
21 changes: 21 additions & 0 deletions src/Kodeine/Metable/Metable.php
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,27 @@ public function toArray(): array {
] );
}

/**
* Calls to laravel's getAttribute method.
*
* @param $key
* @return mixed
*/
public function getAttributeRaw($key) {
return parent::getAttribute( $key );
}

/**
* Calls to laravel's setAttribute method.
*
* @param $key
* @param $value
* @return mixed
*/
public function setAttributeRaw($key, $value) {
return parent::setAttribute( $key, $value );
}

/**
* Model Override functions
* -------------------------.
Expand Down