Asset.php 759 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Model;
  4. class Asset extends Model
  5. {
  6. protected $table = 'pc_owner';
  7. protected $primaryKey = 'pcid';
  8. const CREATED_AT = 'created_date';
  9. const UPDATED_AT = 'modified_date';
  10. public function getPcextraAttribute($value) {
  11. return unserialize($value);
  12. }
  13. public function setPcextraAttribute($value) {
  14. $this->attributes['pcextra'] = serialize($value);
  15. }
  16. public function workOrders()
  17. {
  18. return $this->hasMany('App\WorkOrder');
  19. }
  20. public function group()
  21. {
  22. return $this->belongsTo('App\Group', 'pcgroupid');
  23. }
  24. public function credentials()
  25. {
  26. return $this->hasMany('App\Credential', 'pcid', 'pcid');
  27. }
  28. }