Clean up API references.

This commit is contained in:
James Cole
2018-06-20 21:17:16 +02:00
parent 1222184b68
commit ae6e5a5599
5 changed files with 9 additions and 14 deletions

View File

@@ -37,7 +37,6 @@ use League\Fractal\Pagination\IlluminatePaginatorAdapter;
use League\Fractal\Resource\Collection as FractalCollection;
use League\Fractal\Resource\Item;
use League\Fractal\Serializer\JsonApiSerializer;
use Preferences;
/**
* Class AccountController
@@ -104,7 +103,7 @@ class AccountController extends Controller
// types to get, page size:
$types = $this->mapTypes($this->parameters->get('type'));
$pageSize = (int)Preferences::getForUser(auth()->user(), 'listPageSize', 50)->data;
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
// get list of accounts. Count it and split it.
$collection = $this->repository->getAccountsByType($types);

View File

@@ -37,7 +37,6 @@ use League\Fractal\Pagination\IlluminatePaginatorAdapter;
use League\Fractal\Resource\Collection as FractalCollection;
use League\Fractal\Resource\Item;
use League\Fractal\Serializer\JsonApiSerializer;
use Preferences;
/**
* Class BillController
@@ -89,7 +88,7 @@ class BillController extends Controller
*/
public function index(Request $request): JsonResponse
{
$pageSize = (int)Preferences::getForUser(auth()->user(), 'listPageSize', 50)->data;
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
$paginator = $this->repository->getPaginator($pageSize);
/** @var Collection $bills */
$bills = $paginator->getCollection();

View File

@@ -38,7 +38,6 @@ use League\Fractal\Pagination\IlluminatePaginatorAdapter;
use League\Fractal\Resource\Collection as FractalCollection;
use League\Fractal\Resource\Item;
use League\Fractal\Serializer\JsonApiSerializer;
use Preferences;
/**
* Class CurrencyController
@@ -101,7 +100,7 @@ class CurrencyController extends Controller
*/
public function index(Request $request): JsonResponse
{
$pageSize = (int)Preferences::getForUser(auth()->user(), 'listPageSize', 50)->data;
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
$collection = $this->repository->get();
$count = $collection->count();
// slice them:
@@ -157,8 +156,8 @@ class CurrencyController extends Controller
$currency = $this->repository->store($request->getAll());
if ($request->boolean('default') === true) {
Preferences::set('currencyPreference', $currency->code);
Preferences::mark();
app('preferences')->set('currencyPreference', $currency->code);
app('preferences')->mark();
}
if (null !== $currency) {
$manager = new Manager();
@@ -188,8 +187,8 @@ class CurrencyController extends Controller
$currency = $this->repository->update($currency, $data);
if ($request->boolean('default') === true) {
Preferences::set('currencyPreference', $currency->code);
Preferences::mark();
app('preferences')->set('currencyPreference', $currency->code);
app('preferences')->mark();
}
$manager = new Manager();

View File

@@ -40,7 +40,6 @@ use League\Fractal\Pagination\IlluminatePaginatorAdapter;
use League\Fractal\Resource\Collection as FractalCollection;
use League\Fractal\Serializer\JsonApiSerializer;
use Log;
use Preferences;
/**
* Class TransactionController
@@ -92,7 +91,7 @@ class TransactionController extends Controller
*/
public function index(Request $request)
{
$pageSize = (int)Preferences::getForUser(auth()->user(), 'listPageSize', 50)->data;
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
// read type from URI
$type = $request->get('type') ?? 'default';

View File

@@ -36,7 +36,6 @@ use League\Fractal\Pagination\IlluminatePaginatorAdapter;
use League\Fractal\Resource\Collection as FractalCollection;
use League\Fractal\Resource\Item;
use League\Fractal\Serializer\JsonApiSerializer;
use Preferences;
/**
@@ -94,7 +93,7 @@ class UserController extends Controller
public function index(Request $request)
{
// user preferences
$pageSize = (int)Preferences::getForUser(auth()->user(), 'listPageSize', 50)->data;
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
// make manager
$manager = new Manager();