mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-20 16:40:10 +00:00
Code cleanup.
This commit is contained in:
@@ -44,8 +44,6 @@ class CreateController extends Controller
|
||||
|
||||
/**
|
||||
* CategoryController constructor.
|
||||
*
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -66,8 +64,6 @@ class CreateController extends Controller
|
||||
/**
|
||||
* Create category.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Factory|View
|
||||
*/
|
||||
public function create(Request $request)
|
||||
@@ -84,9 +80,8 @@ class CreateController extends Controller
|
||||
/**
|
||||
* Store new category.
|
||||
*
|
||||
* @param CategoryFormRequest $request
|
||||
* @return $this|Redirector|RedirectResponse
|
||||
*
|
||||
* @return $this|RedirectResponse|Redirector
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function store(CategoryFormRequest $request)
|
||||
@@ -98,7 +93,7 @@ class CreateController extends Controller
|
||||
app('preferences')->mark();
|
||||
|
||||
// store attachment(s):
|
||||
/** @var array|null $files */
|
||||
/** @var null|array $files */
|
||||
$files = $request->hasFile('attachments') ? $request->file('attachments') : null;
|
||||
if (null !== $files && !auth()->user()->hasRole('demo')) {
|
||||
$this->attachments->saveAttachmentsForModel($category, $files);
|
||||
|
||||
@@ -42,8 +42,6 @@ class DeleteController extends Controller
|
||||
|
||||
/**
|
||||
* CategoryController constructor.
|
||||
*
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -63,8 +61,6 @@ class DeleteController extends Controller
|
||||
/**
|
||||
* Delete a category.
|
||||
*
|
||||
* @param Category $category
|
||||
*
|
||||
* @return Factory|View
|
||||
*/
|
||||
public function delete(Category $category)
|
||||
@@ -80,10 +76,7 @@ class DeleteController extends Controller
|
||||
/**
|
||||
* Destroy a category.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Category $category
|
||||
*
|
||||
* @return RedirectResponse|Redirector
|
||||
* @return Redirector|RedirectResponse
|
||||
*/
|
||||
public function destroy(Request $request, Category $category)
|
||||
{
|
||||
|
||||
@@ -44,8 +44,6 @@ class EditController extends Controller
|
||||
|
||||
/**
|
||||
* CategoryController constructor.
|
||||
*
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -66,9 +64,6 @@ class EditController extends Controller
|
||||
/**
|
||||
* Edit a category.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Category $category
|
||||
*
|
||||
* @return Factory|View
|
||||
*/
|
||||
public function edit(Request $request, Category $category)
|
||||
@@ -91,10 +86,7 @@ class EditController extends Controller
|
||||
/**
|
||||
* Update category.
|
||||
*
|
||||
* @param CategoryFormRequest $request
|
||||
* @param Category $category
|
||||
*
|
||||
* @return RedirectResponse|Redirector
|
||||
* @return Redirector|RedirectResponse
|
||||
*/
|
||||
public function update(CategoryFormRequest $request, Category $category)
|
||||
{
|
||||
@@ -105,7 +97,7 @@ class EditController extends Controller
|
||||
app('preferences')->mark();
|
||||
|
||||
// store new attachment(s):
|
||||
/** @var array|null $files */
|
||||
/** @var null|array $files */
|
||||
$files = $request->hasFile('attachments') ? $request->file('attachments') : null;
|
||||
if (null !== $files && !auth()->user()->hasRole('demo')) {
|
||||
$this->attachments->saveAttachmentsForModel($category, $files);
|
||||
|
||||
@@ -44,8 +44,6 @@ class IndexController extends Controller
|
||||
|
||||
/**
|
||||
* CategoryController constructor.
|
||||
*
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -65,9 +63,8 @@ class IndexController extends Controller
|
||||
/**
|
||||
* Show all categories.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Factory|View
|
||||
*
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
|
||||
@@ -38,7 +38,6 @@ use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
* Class NoCategoryController
|
||||
*/
|
||||
class NoCategoryController extends Controller
|
||||
@@ -49,8 +48,6 @@ class NoCategoryController extends Controller
|
||||
|
||||
/**
|
||||
* CategoryController constructor.
|
||||
*
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -71,11 +68,8 @@ class NoCategoryController extends Controller
|
||||
/**
|
||||
* Show transactions without a category.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Carbon|null $start
|
||||
* @param Carbon|null $end
|
||||
*
|
||||
* @return Factory|View
|
||||
*
|
||||
* @throws FireflyException
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
@@ -83,9 +77,9 @@ class NoCategoryController extends Controller
|
||||
public function show(Request $request, Carbon $start = null, Carbon $end = null)
|
||||
{
|
||||
app('log')->debug('Start of noCategory()');
|
||||
/** @var Carbon $start */
|
||||
// @var Carbon $start
|
||||
$start ??= session('start');
|
||||
/** @var Carbon $end */
|
||||
// @var Carbon $end
|
||||
$end ??= session('end');
|
||||
$page = (int)$request->get('page');
|
||||
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
|
||||
@@ -101,9 +95,10 @@ class NoCategoryController extends Controller
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
$collector->setRange($start, $end)
|
||||
->setLimit($pageSize)->setPage($page)->withoutCategory()
|
||||
->withAccountInformation()->withBudgetInformation()
|
||||
->setTypes([TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::TRANSFER]);
|
||||
->setLimit($pageSize)->setPage($page)->withoutCategory()
|
||||
->withAccountInformation()->withBudgetInformation()
|
||||
->setTypes([TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::TRANSFER])
|
||||
;
|
||||
$groups = $collector->getPaginatedGroups();
|
||||
$groups->setPath(route('categories.no-category', [$start->format('Y-m-d'), $end->format('Y-m-d')]));
|
||||
|
||||
@@ -113,9 +108,8 @@ class NoCategoryController extends Controller
|
||||
/**
|
||||
* Show all transactions without a category.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Factory|View
|
||||
*
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
@@ -138,8 +132,9 @@ class NoCategoryController extends Controller
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
$collector->setRange($start, $end)->setLimit($pageSize)->setPage($page)->withoutCategory()
|
||||
->withAccountInformation()->withBudgetInformation()
|
||||
->setTypes([TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::TRANSFER]);
|
||||
->withAccountInformation()->withBudgetInformation()
|
||||
->setTypes([TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::TRANSFER])
|
||||
;
|
||||
$groups = $collector->getPaginatedGroups();
|
||||
$groups->setPath(route('categories.no-category.all'));
|
||||
|
||||
|
||||
@@ -38,9 +38,7 @@ use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
* Class ShowController
|
||||
*
|
||||
*/
|
||||
class ShowController extends Controller
|
||||
{
|
||||
@@ -51,8 +49,6 @@ class ShowController extends Controller
|
||||
|
||||
/**
|
||||
* CategoryController constructor.
|
||||
*
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -73,21 +69,17 @@ class ShowController extends Controller
|
||||
/**
|
||||
* Show a single category.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Category $category
|
||||
* @param Carbon|null $start
|
||||
* @param Carbon|null $end
|
||||
*
|
||||
* @return Factory|View
|
||||
*
|
||||
* @throws FireflyException
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function show(Request $request, Category $category, Carbon $start = null, Carbon $end = null)
|
||||
{
|
||||
/** @var Carbon $start */
|
||||
// @var Carbon $start
|
||||
$start ??= session('start', today(config('app.timezone'))->startOfMonth());
|
||||
/** @var Carbon $end */
|
||||
// @var Carbon $end
|
||||
$end ??= session('end', today(config('app.timezone'))->endOfMonth());
|
||||
$subTitleIcon = 'fa-bookmark';
|
||||
$page = (int)$request->get('page');
|
||||
@@ -108,8 +100,9 @@ class ShowController extends Controller
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
$collector->setRange($start, $end)->setLimit($pageSize)->setPage($page)
|
||||
->withAccountInformation()
|
||||
->setCategory($category)->withBudgetInformation()->withCategoryInformation();
|
||||
->withAccountInformation()
|
||||
->setCategory($category)->withBudgetInformation()->withCategoryInformation()
|
||||
;
|
||||
|
||||
$groups = $collector->getPaginatedGroups();
|
||||
$groups->setPath($path);
|
||||
@@ -120,10 +113,8 @@ class ShowController extends Controller
|
||||
/**
|
||||
* Show all transactions within a category.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Category $category
|
||||
*
|
||||
* @return Factory|View
|
||||
*
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
@@ -139,6 +130,7 @@ class ShowController extends Controller
|
||||
|
||||
$subTitle = (string)trans('firefly.all_journals_for_category', ['name' => $category->name]);
|
||||
$first = $this->repository->firstUseDate($category);
|
||||
|
||||
/** @var Carbon $start */
|
||||
$start = $first ?? today(config('app.timezone'));
|
||||
$end = today(config('app.timezone'));
|
||||
@@ -148,8 +140,9 @@ class ShowController extends Controller
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
$collector->setRange($start, $end)->setLimit($pageSize)->setPage($page)
|
||||
->withAccountInformation()
|
||||
->setCategory($category)->withBudgetInformation()->withCategoryInformation();
|
||||
->withAccountInformation()
|
||||
->setCategory($category)->withBudgetInformation()->withCategoryInformation()
|
||||
;
|
||||
|
||||
$groups = $collector->getPaginatedGroups();
|
||||
$groups->setPath($path);
|
||||
|
||||
Reference in New Issue
Block a user