| 1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- namespace App;
- use Illuminate\Database\Eloquent\Model;
- use App\Traits\ModelTimeFormat;
- use Illuminate\Support\Facades\Cache;
- class UserLabor extends Model
- {
- use ModelTimeFormat;
- protected $primaryKey='user_id';
- public $incrementing=false;
- public $timestamps=false;
- protected $fillable=[
- 'user_id','default_hour_price','labor_company_id'
- ];
- protected $appends = [
- 'is_relieve_facility',
- ];
- public function userDetail(){
- return $this->belongsTo('App\UserDetail','user_id','user_id');
- }
- public function laborCompany(){
- return $this->belongsTo('App\LaborCompany');
- }
- public function getIsRelieveFacilityAttribute(){
- $user_id=$this['user_id'];
- $token=Cache::get('tokenUser_'.$user_id);
- if (Cache::has('tokenStr_'.$token)){
- return true;
- }
- return false;
- }
- }
|