Outlets.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class Outlets extends Model
  5. {
  6. //
  7. protected $table = "tb_resto_branches";
  8. public function main_images(){
  9. return $this->hasOne('App\Models\Photos','branch_id','id')->where('photo_type','branch');
  10. }
  11. public function delivery_feature(){
  12. return $this->hasOne('App\Models\BranchFeatures','branch_id','id')->where('feature_type','delivery');
  13. }
  14. public function delivery_hours_feature(){
  15. return $this->hasMany('App\Models\BranchHours','branch_id','id')->where('hours_for','delivery');
  16. }
  17. public function pickup_feature(){
  18. return $this->hasOne('App\Models\BranchFeatures','branch_id','id')->where('feature_type','pickup');
  19. }
  20. public function contactless_dining_feature(){
  21. return $this->hasOne('App\Models\BranchFeatures','branch_id','id')->where('feature_type','contactless_dining');
  22. }
  23. public function pickup_hours_feature(){
  24. return $this->hasMany('App\Models\BranchHours','branch_id','id')->where('hours_for','pickup');
  25. }
  26. public function countries(){
  27. return $this->hasOne('App\Models\Countries','id','country_id');
  28. }
  29. public function resto_metas(){
  30. return $this->hasMany('App\Models\RestoMetas','outlet_id','id');
  31. }
  32. public function outlet_orders(){
  33. return $this->hasMany('App\Models\Orders','outlet_id','id')->where('status','Has_Delivered')->whereNull('deleted_at');
  34. }
  35. }