| 1234567891011121314151617181920212223242526272829 |
- <?php
- namespace App;
- use Illuminate\Database\Eloquent\Model;
- class ProcessDailyParticipant extends Model
- {
- protected $fillable=[
- 'process_daily_id','user_id','started_at','ended_at','hour_price',
- 'hour_count','unit_price','unit_count','dinner_duration','remark'
- ];
- protected $appends=[
- 'user_name'
- ];
- public function processDaily(){
- return $this->belongsTo('App\ProcessDaily','process_daily_id','id');
- }
- public function user(){
- return $this->belongsTo('App\User','user_id','id');
- }
- public function getAttribute()
- {
- return $this['user']?$this['user']['name']:null;
- }
- }
|