JobsContact.php 630 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: wuzhenke
  5. * Date: 2018/11/9
  6. * Time: 15:38
  7. */
  8. namespace App\Models;
  9. use Illuminate\Database\Eloquent\Model;
  10. class JobsContact extends Model
  11. {
  12. protected $guarded = [''];
  13. public function jobs()
  14. {
  15. return $this->belongsTo(Jobs::class, 'id', 'job_id');
  16. }
  17. public function getLandlineTelAttribute($value)
  18. {
  19. if ($value) {
  20. return explode('-', $value);
  21. }
  22. }
  23. public function setLandlineTelAttribute($value)
  24. {
  25. if ($value) {
  26. $this->attributes['landline_tel'] = implode('-', $value);
  27. }
  28. }
  29. }