SupplyOrder.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace App\Models;
  3. # use Illuminate\Database\Eloquent\Model;
  4. class SupplyOrder extends Model
  5. {
  6. protected $table = 'supply_order';
  7. public function getRouteKeyName()
  8. {
  9. return 'uid';
  10. }
  11. public function client()
  12. {
  13. return $this->hasOne(Client::class, 'id', 'client_id');
  14. }
  15. public function product()
  16. {
  17. return $this->hasOne(Product::class, 'id', 'product_id');
  18. }
  19. public function shipment()
  20. {
  21. return $this->hasOne(Shipment::class, 'id', 'shipment_id');
  22. }
  23. public function signedPro() {
  24. return $this->hasOne(Pro::class, 'id', 'signed_by_pro_id');
  25. }
  26. public function waiverPro() {
  27. return $this->hasOne(Pro::class, 'id', 'client_signature_waived_by_pro_id');
  28. }
  29. public function clearedForShipmentPro() {
  30. return $this->hasOne(Pro::class, 'id', 'cleared_for_shipment_by_pro_id');
  31. }
  32. public function createdSession()
  33. {
  34. return $this->hasOne(AppSession::class, 'id', 'created_by_session_id');
  35. }
  36. public function createdByPro()
  37. {
  38. return $this->hasOne(Pro::class, 'id', 'created_by_pro_id');
  39. }
  40. }