DistAppearanceVariable.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace App\Admin\Repositories;
  3. use App\Models\DistAppearanceVariable as Model;
  4. use Dcat\Admin\Form;
  5. use Dcat\Admin\Repositories\EloquentRepository;
  6. class DistAppearanceVariable extends EloquentRepository
  7. {
  8. /**
  9. * Model.
  10. *
  11. * @var string
  12. */
  13. protected $eloquentClass = Model::class;
  14. public static function getVariableRow($distId,$appearanceId,$templateId)
  15. {
  16. $model = new Model();
  17. $variable = $model->where('dist_id',$distId)->where('appearance_id',$appearanceId)->whereIn('template_id',[0,$templateId])->get();
  18. if($variable){
  19. return $variable;
  20. }else{
  21. return '';
  22. }
  23. }
  24. /*
  25. * 把原始变量复制给分销商
  26. */
  27. public static function copyAppearanceVariable($appearanceId, $distId){
  28. Model::copyAppearanceVariable($appearanceId, $distId);
  29. }
  30. /*
  31. * 删除分销商主题变量
  32. */
  33. public static function deleteVariable($appearanceId,$distId)
  34. {
  35. return Model::where('appearance_id', $appearanceId)->where('dist_id', $distId)->delete();
  36. }
  37. }