diff options
author | Camil Staps | 2015-05-14 11:18:12 +0200 |
---|---|---|
committer | Camil Staps | 2015-05-14 11:18:12 +0200 |
commit | a012ea9e7d5dd0baadb549e1460a8339224f37a5 (patch) | |
tree | a74414754eb8d00d21d92d1ca5be274235ac8e52 /src/CamilStaps/BotleaguesApi/Database/Model.php | |
parent | Password reminders start (diff) |
Own Model class; new namespaces Database and Controllers; RFC2822 dates
Diffstat (limited to 'src/CamilStaps/BotleaguesApi/Database/Model.php')
-rw-r--r-- | src/CamilStaps/BotleaguesApi/Database/Model.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/CamilStaps/BotleaguesApi/Database/Model.php b/src/CamilStaps/BotleaguesApi/Database/Model.php new file mode 100644 index 0000000..27bd1fc --- /dev/null +++ b/src/CamilStaps/BotleaguesApi/Database/Model.php @@ -0,0 +1,30 @@ +<?php +/** + * Created by PhpStorm. + * User: camilstaps + * Date: 14-5-15 + * Time: 10:47 + */ + +namespace CamilStaps\BotleaguesApi\Database; + +use Carbon\Carbon; + + +class Model extends \Illuminate\Database\Eloquent\Model { + + protected $date_format = Carbon::RFC2822; + + protected function formatDate($date) { + return Carbon::parse($date)->format($this->date_format); + } + + public function getCreatedAtAttribute($attr) { + return $this->formatDate($attr); + } + + public function getUpdatedAtAttribute($attr) { + return $this->formatDate($attr); + } + +}
\ No newline at end of file |