feat: phase 3 — stock balances, restock/adjust mutations with activity logging, movements page

This commit is contained in:
sean
2026-08-25 18:46:03 +07:00
parent 4298544381
commit 002fdce854
7 changed files with 601 additions and 2 deletions
+45
View File
@@ -0,0 +1,45 @@
<?php
namespace App\Services;
use App\Services\InsForge\InsForgeTableService;
use Illuminate\Pagination\LengthAwarePaginator;
class StockMovementService extends InsForgeTableService
{
public const TYPES = ['restock', 'adjustment', 'order_out'];
protected function table(): string
{
return 'stock_movements';
}
protected function select(): string
{
return '*,products(code,name)';
}
protected function searchableColumns(): array
{
return ['notes', 'type'];
}
protected function sortableColumns(): array
{
return ['created_at', 'quantity', 'type'];
}
/** @param array<string, mixed> $filters */
public function paginate(
?string $search = null,
?string $sortColumn = null,
?string $sortDirection = null,
int $page = 1,
int $perPage = 25,
array $filters = [],
): LengthAwarePaginator {
$extra = array_intersect_key($filters, array_flip(['type', 'product_id']));
return parent::paginate($search, $sortColumn, $sortDirection, $page, $perPage, $extra);
}
}