<?php

namespace App\Services;


use App\UserOwnerGroup;
use App\Traits\ServiceAppAop;


class UserOwnerGroupService
{
    use ServiceAppAop;
    protected $modelClass=UserOwnerGroup::class;
    public function getSelection($column = ['id', 'name'])
    {
        return UserOwnerGroup::query()->select($column)->get();
    }

    public function paginate()
    {
        return UserOwnerGroup::query()->orderByDesc('id')->paginate(50);
    }

    public function create(array $params)
    {
        return UserOwnerGroup::query()->create($params);
    }


    public function find($id)
    {
        return UserOwnerGroup::query()->find($id);
    }

    public function update(array $params, array $values)
    {
        $query = UserOwnerGroup::query();
        foreach ($params as $column => $value){
            $query->where($column,$value);
        }
        return $query->update($values);
    }

    public function destroy($id)
    {
        return UserOwnerGroup::destroy($id);
    }
}
