| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- namespace App\Services;
- use App\OwnerStoragePriceModel;
- Class OwnerStoragePriceModelService
- {
- public function getSelection(array $columns = ["counting_type","using_type"], array $withs = [])
- {
- return OwnerStoragePriceModel::query()->select($columns)->with($withs)->get();
- }
- public function paginate(array $withs = [])
- {
- return OwnerStoragePriceModel::query()->orderByDesc('id')->with($withs)->paginate($params["paginate"] ?? 50);
- }
- public function create(array $params)
- {
- return OwnerStoragePriceModel::query()->create($params);
- }
- public function update(array $params, array $values)
- {
- $query = OwnerStoragePriceModel::query();
- foreach ($params as $column => $value){
- $query->where($column,$value);
- }
- return $query->update($values);
- }
- public function find($id)
- {
- return OwnerStoragePriceModel::query()->find($id);
- }
- public function destroy($id)
- {
- return OwnerStoragePriceModel::destroy($id);
- }
- }
|