<?php

namespace App\Services;

use App\Owner;
use App\OwnerMaterial;
use Illuminate\Support\Facades\Auth;
use App\Traits\ServiceAppAop;


class OwnerMaterialService
{
    use ServiceAppAop;
    protected $modelClass=OwnerMaterial::class;
    public function getOwnerPermittingWithMaterial()
    {
        $ownerIds=app('UserService')->getPermittingOwnerIds(Auth::user());
        return Owner::query()->with(['ownerMaterials.material','customer'])->select(['id','name','customer_id'])->whereIn('id', $ownerIds)->get();
    }
}
