Remove reference to guard from other bind support classes.

This commit is contained in:
James Cole 2018-02-09 19:24:30 +01:00
parent 53a6c10ada
commit 0f09a9db4d
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
9 changed files with 23 additions and 23 deletions

View File

@ -39,9 +39,9 @@ class AccountList implements BinderInterface
*
* @return Collection
*/
public static function routeBinder($guard, string $value, Route $route): Collection
public static function routeBinder(string $value, Route $route): Collection
{
if ($guard->check()) {
if (auth()->check()) {
$list = [];
$incoming = explode(',', $value);
foreach ($incoming as $entry) {
@ -53,7 +53,7 @@ class AccountList implements BinderInterface
}
/** @var \Illuminate\Support\Collection $collection */
$collection = $guard->user()->accounts()
$collection = auth()->user()->accounts()
->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
->whereIn('accounts.id', $list)
->get(['accounts.*']);

View File

@ -35,5 +35,5 @@ interface BinderInterface
*
* @return mixed
*/
public static function routeBinder($guard, string $value, Route $route);
public static function routeBinder(string $value, Route $route);
}

View File

@ -38,9 +38,9 @@ class BudgetList implements BinderInterface
*
* @return Collection
*/
public static function routeBinder($guard, string $value, Route $route): Collection
public static function routeBinder(string $value, Route $route): Collection
{
if ($guard->check()) {
if (auth()->check()) {
$list = [];
$incoming = explode(',', $value);
foreach ($incoming as $entry) {
@ -52,7 +52,7 @@ class BudgetList implements BinderInterface
}
/** @var \Illuminate\Support\Collection $collection */
$collection = $guard->user()->budgets()
$collection = auth()->user()->budgets()
->where('active', 1)
->whereIn('id', $list)
->get();

View File

@ -38,9 +38,9 @@ class CategoryList implements BinderInterface
*
* @return Collection
*/
public static function routeBinder($guard, string $value, Route $route): Collection
public static function routeBinder(string $value, Route $route): Collection
{
if ($guard->check()) {
if (auth()->check()) {
$list = [];
$incoming = explode(',', $value);
foreach ($incoming as $entry) {
@ -52,7 +52,7 @@ class CategoryList implements BinderInterface
}
/** @var \Illuminate\Support\Collection $collection */
$collection = $guard->user()->categories()
$collection = auth()->user()->categories()
->whereIn('id', $list)
->get();

View File

@ -37,9 +37,9 @@ class CurrencyCode implements BinderInterface
*
* @return TransactionCurrency
*/
public static function routeBinder($guard, string $value, Route $route): TransactionCurrency
public static function routeBinder(string $value, Route $route): TransactionCurrency
{
if ($guard->check()) {
if (auth()->check()) {
$currency = TransactionCurrency::where('code', trim($value))->first();
if (null !== $currency) {
return $currency;

View File

@ -40,7 +40,7 @@ class Date implements BinderInterface
*
* @return Carbon
*/
public static function routeBinder($guard, string $value, Route $route): Carbon
public static function routeBinder(string $value, Route $route): Carbon
{
/** @var FiscalHelperInterface $fiscalHelper */
$fiscalHelper = app(FiscalHelperInterface::class);

View File

@ -37,9 +37,9 @@ class JournalList implements BinderInterface
*
* @return mixed
*/
public static function routeBinder($guard, string $value, Route $route): Collection
public static function routeBinder(string $value, Route $route): Collection
{
if ($guard->check()) {
if (auth()->check()) {
$list = [];
$incoming = explode(',', $value);
foreach ($incoming as $entry) {
@ -51,7 +51,7 @@ class JournalList implements BinderInterface
}
/** @var \Illuminate\Support\Collection $collection */
$collection = $guard->user()->transactionJournals()
$collection = auth()->user()->transactionJournals()
->whereIn('transaction_journals.id', $list)
->where('transaction_journals.completed', 1)
->get(['transaction_journals.*']);

View File

@ -39,9 +39,9 @@ class TagList implements BinderInterface
*
* @return Collection
*/
public static function routeBinder($guard, string $value, Route $route): Collection
public static function routeBinder(string $value, Route $route): Collection
{
if ($guard->check()) {
if (auth()->check()) {
$list = [];
$incoming = explode(',', $value);
foreach ($incoming as $entry) {
@ -53,7 +53,7 @@ class TagList implements BinderInterface
}
/** @var TagRepositoryInterface $repository */
$repository = app(TagRepositoryInterface::class);
$repository->setUser($guard->user());
$repository->setUser(auth()->user());
$allTags = $repository->get();
$collection = $allTags->filter(

View File

@ -37,13 +37,13 @@ class UnfinishedJournal implements BinderInterface
*
* @return TransactionJournal
*/
public static function routeBinder($guard, string $value, Route $route): TransactionJournal
public static function routeBinder(string $value, Route $route): TransactionJournal
{
if ($guard->check()) {
$journal = $guard->user()->transactionJournals()->where('transaction_journals.id', $value)
if (auth()->check()) {
$journal = auth()->user()->transactionJournals()->where('transaction_journals.id', $value)
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
->where('completed', 0)
->where('user_id', $guard->user()->id)->first(['transaction_journals.*']);
->where('user_id', auth()->user()->id)->first(['transaction_journals.*']);
if (!is_null($journal)) {
return $journal;
}