- Added SupplierController for handling supplier operations. - Created SupplierRequest for validation of supplier data. - Introduced SupplierService for business logic related to suppliers. - Developed UI components for supplier management, including a data table and dialogs for creating and editing suppliers. - Updated routes to include resourceful routes for suppliers. - Added SupplierSeeder for populating initial supplier data. - Implemented tests for supplier functionality, including creation, updating, and deletion.
32 lines
586 B
PHP
32 lines
586 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::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();
|
|
}
|
|
}
|