WIP: billplz api integration testing; DONE: backend for module investment, investment UI for admin
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Investment\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\BaseCrudController;
|
||||
use Modules\Investment\Entities\SalaryContribution;
|
||||
use Modules\Investment\Http\Requests\SalaryContributionRequest;
|
||||
use Modules\Investment\Repositories\Contracts\SalaryContributionRepositoryInterface;
|
||||
use Modules\Investment\Transformers\SalaryContributionResource;
|
||||
|
||||
class SalaryContributionController extends BaseCrudController
|
||||
{
|
||||
protected $modelClass = SalaryContribution::class;
|
||||
|
||||
protected $resourceClass = SalaryContributionResource::class;
|
||||
|
||||
protected $requestClass = SalaryContributionRequest::class;
|
||||
|
||||
protected $resourceName = 'caruman potongan gaji';
|
||||
|
||||
protected $resourceNamePlural = 'caruman potongan gaji';
|
||||
|
||||
public function __construct(
|
||||
SalaryContributionRepositoryInterface $repository,
|
||||
) {
|
||||
parent::__construct($repository);
|
||||
}
|
||||
|
||||
protected function prepareStoreData(array $validated): array
|
||||
{
|
||||
$validated['created_by'] = auth()->id();
|
||||
|
||||
return $validated;
|
||||
}
|
||||
|
||||
protected function loadShowRelations($item)
|
||||
{
|
||||
return $item->load(['user:id,name,email', 'investmentType:id,code,name']);
|
||||
}
|
||||
|
||||
protected function getItemName($item): string
|
||||
{
|
||||
return $item->id;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user