| 1 | <?php |
||
| 7 | class Author extends \Eloquent |
||
| 8 | { |
||
| 9 | protected $table = 'demo_users'; |
||
| 10 | |||
| 11 | protected $appends = array('fullname'); |
||
| 12 | |||
| 13 | public function articles() |
||
| 14 | { |
||
| 15 | return $this->hasMany('\Tacone\Bees\Demo\Models\Article'); |
||
| 16 | } |
||
| 17 | |||
| 18 | public function comments() |
||
| 19 | { |
||
| 20 | return $this->hasMany('\Tacone\Bees\Demo\Models\Comment'); |
||
| 21 | } |
||
| 22 | |||
| 23 | public function getFullnameAttribute($value) |
||
| 24 | { |
||
| 25 | return $this->firstname." ".$this->lastname; |
||
| 26 | } |
||
| 27 | } |
||
| 28 |