- Updated CustomerService to simplify getAll method. - Refactored ProductService to utilize HasRoleChecks trait and improved role verification logic. - Enhanced ProductVariantService with new methods for fetching data for restocking and transactions. - Cleaned up RawMaterialService by removing unused methods and improving data retrieval. - Adjusted SupplierService to streamline getAll method. - Refactored RoleService to use Spatie's Role model and improved role filtering logic. - Updated NotificationService to handle role labels more effectively. - Improved StockMutationService by removing redundant paginated method. - Cleaned up various frontend components to directly accept necessary props instead of nested data objects. - Updated tests to reflect changes in service method names and ensure proper notification handling.
36 lines
1.0 KiB
PHP
36 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin\Finance\Payroll;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Payroll;
|
|
use App\Services\Admin\Finance\Payroll\PayrollPeriodService;
|
|
use Illuminate\Http\RedirectResponse;
|
|
|
|
class PayrollController extends Controller
|
|
{
|
|
public function __construct(
|
|
private PayrollPeriodService $service
|
|
) {}
|
|
|
|
public function pay(Payroll $payroll): RedirectResponse
|
|
{
|
|
return $this->handleAction(
|
|
fn () => $this->service->pay($payroll),
|
|
'Gaji berhasil dibayar.',
|
|
'admin.finance.payroll-periods.show',
|
|
parameters: ['payroll_period' => $payroll->payroll_period_id]
|
|
);
|
|
}
|
|
|
|
public function cancel(Payroll $payroll): RedirectResponse
|
|
{
|
|
return $this->handleAction(
|
|
fn () => $this->service->cancel($payroll),
|
|
'Gaji berhasil dibatalkan.',
|
|
'admin.finance.payroll-periods.show',
|
|
parameters: ['payroll_period' => $payroll->payroll_period_id]
|
|
);
|
|
}
|
|
}
|