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

32 lines
635 B
PHP

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