Combinations.php 919 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace App\Repositories\Models\TCM;
  3. use App\Repositories\Models\Model;
  4. use Prettus\Repository\Contracts\Transformable;
  5. use Prettus\Repository\Traits\TransformableTrait;
  6. /**
  7. * Class Patient.
  8. *
  9. * @package namespace App\Repositories\Models\TCM;
  10. */
  11. class Combinations extends Model implements Transformable
  12. {
  13. use TransformableTrait;
  14. protected $table = 'tcm_combinations';
  15. /**
  16. * The attributes that are mass assignable.
  17. *
  18. * @var array
  19. */
  20. protected $guarded = [];
  21. protected static function booted()
  22. {
  23. self::language();
  24. }
  25. public function prescription()
  26. {
  27. return $this->belongsTo(Prescription::class);
  28. }
  29. public function setNameAttribute($val)
  30. {
  31. $this->attributes['name'] = '-' . arr2str($val, '-') . '-';
  32. }
  33. public function getNameAttribute($val)
  34. {
  35. return str2arr(trim($val, '-'), '-');
  36. }
  37. }