Created
September 19, 2017 16:23
-
-
Save mediaash/772d243f790f7af6e6eb64fba882c781 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace MyApp\Model; | |
use Illuminate\Database\Eloquent\Model as EloquentModel; | |
use Illuminate\Support\Str; | |
/** | |
* Class CamelModel. | |
* | |
* @mixin \Illuminate\Database\Eloquent\Builder | |
*/ | |
abstract class Model extends EloquentModel | |
{ | |
public function getAttribute($key) | |
{ | |
return parent::getAttribute(Str::snake($key)); | |
} | |
public function setAttribute($key, $value) | |
{ | |
return parent::setAttribute(Str::snake($key), $value); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment