Various code cleanup and fixed alignments.

This commit is contained in:
James Cole
2024-01-01 14:41:31 +01:00
parent 8b9dce70bb
commit 657262f179
119 changed files with 1022 additions and 1021 deletions

View File

@@ -54,7 +54,7 @@ class StoreController extends Controller
$this->middleware(
function ($request, $next) {
/** @var User $user */
$user = auth()->user();
$user = auth()->user();
$this->repository = app(LinkTypeRepositoryInterface::class);
$this->journalRepository = app(JournalRepositoryInterface::class);
@@ -77,22 +77,22 @@ class StoreController extends Controller
*/
public function store(StoreRequest $request): JsonResponse
{
$manager = $this->getManager();
$data = $request->getAll();
$inward = $this->journalRepository->find($data['inward_id'] ?? 0);
$outward = $this->journalRepository->find($data['outward_id'] ?? 0);
$manager = $this->getManager();
$data = $request->getAll();
$inward = $this->journalRepository->find($data['inward_id'] ?? 0);
$outward = $this->journalRepository->find($data['outward_id'] ?? 0);
if (null === $inward || null === $outward) {
throw new FireflyException('200024: Source or destination does not exist.');
}
$data['direction'] = 'inward';
$journalLink = $this->repository->storeLink($data, $inward, $outward);
$journalLink = $this->repository->storeLink($data, $inward, $outward);
/** @var TransactionLinkTransformer $transformer */
$transformer = app(TransactionLinkTransformer::class);
$transformer = app(TransactionLinkTransformer::class);
$transformer->setParameters($this->parameters);
$resource = new Item($journalLink, $transformer, 'transaction_links');
$resource = new Item($journalLink, $transformer, 'transaction_links');
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
}