dstpabuaran.com/app/Services/Admin/Master/SupplierService.php

32 lines
635 B
PHP

<?php
namespace App\Services\Admin\Master;
use App\Models\Supplier;
use Illuminate\Database\Eloquent\Collection;
class SupplierService
{
public function getAll(): Collection
{
return Supplier::select('id', 'name', 'phone_number', 'address')->latest()->get();
}
public function create(array $data): Supplier
{
return Supplier::create($data);
}
public function update(Supplier $supplier, array $data): Supplier
{
$supplier->update($data);
return $supplier;
}
public function delete(Supplier $supplier): bool
{
return $supplier->delete();
}
}