Skip to content

Commit

Permalink
Updated README.md (#84)
Browse files Browse the repository at this point in the history
Added a way to handle translatable models by binding a method to the model.
  • Loading branch information
mohamedary authored Feb 3, 2021
1 parent 4097959 commit 8423628
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,17 @@ The following strings are translatable (add then in your language file located i
- 'Selected'
- 'Press enter to remove'

If you do use nova-translatable and would like to return the translated name add this to your translatable model:
```php
/**
* @return mixed
*/
public function getNameAttribute()
{
return $this->getTranslations('name')[app()->getLocale()];
}
```

## Sample

[Demo Project](https://github.com/orlyapps/laravel-nova-demo)
Expand Down

0 comments on commit 8423628

Please sign in to comment.