<?php

namespace App\Services;


use App\ProcessMethod;
use App\Traits\ServiceAppAop;


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

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

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


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

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

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

}
