| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- namespace App\Services;
- use App\OwnerOutStorageRule;
- use App\Traits\ServiceAppAop;
- Class OwnerOutStorageRuleService
- {
- use ServiceAppAop;
- public function get(array $params, array $withs = [], $isTranslateFeature = false, array $translateColumn = [])
- {
- if ($isTranslateFeature){
- $features = app("FeatureService")->getMapArray();
- OwnerOutStorageRule::$features = $features;
- OwnerOutStorageRule::$columnMapping = $translateColumn;
- }
- $rule = OwnerOutStorageRule::query();
- if ($withs)$rule->with($withs);
- foreach ($params as $column=>$param){
- $rule->where($column,$param);
- }
- return $rule->get();
- }
- public function update(array $params, array $values)
- {
- $query = OwnerOutStorageRule::query();
- foreach ($params as $column=>$param){
- $query->where($column,$param);
- }
- return $query->update($values);
- }
- public function create(array $params)
- {
- return OwnerOutStorageRule::query()->create($params);
- }
- public function findUpdate(OwnerOutStorageRule $rule, array $values)
- {
- return $rule->update($values);
- }
- public function find($id)
- {
- return OwnerOutStorageRule::query()->find($id);
- }
- public function isExist(array $params)
- {
- $query = OwnerOutStorageRule::query();
- foreach ($params as $column=>$param){
- $query->where($column,$param);
- }
- return $query->count();
- }
- }
|