ProductConfiguration.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /* * ********************************************************************
  3. * ProxmoxVPS Product developed. (26.03.19)
  4. * *
  5. *
  6. * CREATED BY MODULESGARDEN -> http://modulesgarden.com
  7. * CONTACT -> contact@modulesgarden.com
  8. *
  9. *
  10. * This software is furnished under a license and may be used and copied
  11. * only in accordance with the terms of such license and with the
  12. * inclusion of the above copyright notice. This software or any other
  13. * copies thereof may not be provided or otherwise made available to any
  14. * other person. No title to and ownership of the software is hereby
  15. * transferred.
  16. *
  17. *
  18. * ******************************************************************** */
  19. namespace ModulesGarden\ProxmoxAddon\App\Models;
  20. use ModulesGarden\ProxmoxAddon\Core\Models\ExtendedEloquentModel;
  21. /**
  22. * @property string $setting
  23. * @property int $product_id
  24. * @property string $value
  25. * @method static ProductConfiguration ofProductId($productId)
  26. * @method static ProductConfiguration ofSetting($productId)
  27. */
  28. class ProductConfiguration extends ExtendedEloquentModel
  29. {
  30. protected $table = 'ProductConfiguration';
  31. protected $primaryKey = 'setting';
  32. public $incrementing = false;
  33. /**
  34. * The attributes that should be cast to native types.
  35. *
  36. * @var array
  37. */
  38. protected $casts = [
  39. 'value' => 'array',
  40. ];
  41. /**
  42. * Eloquent fillable parameters
  43. * @var array
  44. */
  45. protected $fillable = ['product_id', 'setting', 'value'];
  46. public $timestamps = false;
  47. public function scopeOfProductId($query, $productId)
  48. {
  49. return $query->where("product_id", $productId);
  50. }
  51. public function scopeOfSetting($query, $setting)
  52. {
  53. return $query->where("setting", $setting);
  54. }
  55. public function scopeOfValue($query, $value)
  56. {
  57. return $query->where("value", $value);
  58. }
  59. }