| 123456789101112131415161718192021222324252627 |
- <?php
- namespace App;
- use Illuminate\Database\Eloquent\Model;
- class UserLabor extends Model
- {
- protected $primaryKey='user_id';
- public $incrementing=false;
- protected $fillable=[
- 'user_id','default_hour_price','company'
- ];
- protected $appends=[
- 'user_name'
- ];
- public function user(){
- return $this->belongsTo('App\User','user_id','id');
- }
- public function getAttribute()
- {
- return $this['user']?$this['user']['name']:null;
- }
- }
|