Remove reference to guard from models.

This commit is contained in:
James Cole 2018-02-09 19:24:15 +01:00
parent 14772469ed
commit 53a6c10ada
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
17 changed files with 21 additions and 21 deletions

View File

@ -118,11 +118,11 @@ class Account extends Model
* *
* @return Account * @return Account
*/ */
public static function routeBinder($guard, string $value): Account public static function routeBinder(string $value): Account
{ {
if ($guard->check()) { if (auth()->check()) {
$accountId = intval($value); $accountId = intval($value);
$account = $guard->user()->accounts()->find($accountId); $account = auth()->user()->accounts()->find($accountId);
if (!is_null($account)) { if (!is_null($account)) {
return $account; return $account;
} }

View File

@ -56,7 +56,7 @@ class Attachment extends Model
* *
* @return Attachment * @return Attachment
*/ */
public static function routeBinder($guard, string $value): Attachment public static function routeBinder(string $value): Attachment
{ {
if ($guard->check()) { if ($guard->check()) {
$attachmentId = intval($value); $attachmentId = intval($value);

View File

@ -73,11 +73,11 @@ class Bill extends Model
* *
* @return Bill * @return Bill
*/ */
public static function routeBinder($guard, string $value): Bill public static function routeBinder(string $value): Bill
{ {
if ($guard->check()) { if (auth()->check()) {
$billId = intval($value); $billId = intval($value);
$bill = $guard->user()->bills()->find($billId); $bill = auth()->user()->bills()->find($billId);
if (!is_null($bill)) { if (!is_null($bill)) {
return $bill; return $bill;
} }

View File

@ -88,7 +88,7 @@ class Budget extends Model
* *
* @return Budget * @return Budget
*/ */
public static function routeBinder($guard, string $value): Budget public static function routeBinder(string $value): Budget
{ {
if ($guard->check()) { if ($guard->check()) {
$budgetId = intval($value); $budgetId = intval($value);

View File

@ -49,7 +49,7 @@ class BudgetLimit extends Model
* *
* @return mixed * @return mixed
*/ */
public static function routeBinder($guard, string $value): BudgetLimit public static function routeBinder(string $value): BudgetLimit
{ {
if ($guard->check()) { if ($guard->check()) {
$budgetLimitId = intval($value); $budgetLimitId = intval($value);

View File

@ -87,7 +87,7 @@ class Category extends Model
* *
* @return Category * @return Category
*/ */
public static function routeBinder($guard, string $value): Category public static function routeBinder(string $value): Category
{ {
if ($guard->check()) { if ($guard->check()) {
$categoryId = intval($value); $categoryId = intval($value);

View File

@ -48,7 +48,7 @@ class ExportJob extends Model
* *
* @throws NotFoundHttpException * @throws NotFoundHttpException
*/ */
public static function routeBinder($guard, string $value): ExportJob public static function routeBinder(string $value): ExportJob
{ {
if ($guard->check()) { if ($guard->check()) {
$key = trim($value); $key = trim($value);

View File

@ -65,7 +65,7 @@ class ImportJob extends Model
* @throws NotFoundHttpException * @throws NotFoundHttpException
* @throws FireflyException * @throws FireflyException
*/ */
public static function routeBinder($guard, string $value): ImportJob public static function routeBinder(string $value): ImportJob
{ {
if ($guard->check()) { if ($guard->check()) {
$key = trim($value); $key = trim($value);

View File

@ -54,7 +54,7 @@ class LinkType extends Model
* *
* @throws NotFoundHttpException * @throws NotFoundHttpException
*/ */
public static function routeBinder($guard, string $value): LinkType public static function routeBinder(string $value): LinkType
{ {
if ($guard->check()) { if ($guard->check()) {
$linkTypeId = intval($value); $linkTypeId = intval($value);

View File

@ -65,7 +65,7 @@ class PiggyBank extends Model
* *
* @return PiggyBank * @return PiggyBank
*/ */
public static function routeBinder($guard, string $value): PiggyBank public static function routeBinder(string $value): PiggyBank
{ {
if ($guard->check()) { if ($guard->check()) {
$piggyBankId = intval($value); $piggyBankId = intval($value);

View File

@ -53,7 +53,7 @@ class Rule extends Model
* *
* @return Rule * @return Rule
*/ */
public static function routeBinder($guard, string $value): Rule public static function routeBinder(string $value): Rule
{ {
if ($guard->check()) { if ($guard->check()) {
$ruleId = intval($value); $ruleId = intval($value);

View File

@ -56,7 +56,7 @@ class RuleGroup extends Model
* *
* @return RuleGroup * @return RuleGroup
*/ */
public static function routeBinder($guard, string $value): RuleGroup public static function routeBinder(string $value): RuleGroup
{ {
if ($guard->check()) { if ($guard->check()) {
$ruleGroupId = intval($value); $ruleGroupId = intval($value);

View File

@ -91,7 +91,7 @@ class Tag extends Model
* *
* @return Tag * @return Tag
*/ */
public static function routeBinder($guard, string $value): Tag public static function routeBinder(string $value): Tag
{ {
if ($guard->check()) { if ($guard->check()) {
$tagId = intval($value); $tagId = intval($value);

View File

@ -58,7 +58,7 @@ class TransactionCurrency extends Model
* *
* @return TransactionCurrency * @return TransactionCurrency
*/ */
public static function routeBinder($guard, string $value): TransactionCurrency public static function routeBinder(string $value): TransactionCurrency
{ {
if ($guard->check()) { if ($guard->check()) {
$currencyId = intval($value); $currencyId = intval($value);

View File

@ -86,7 +86,7 @@ class TransactionJournal extends Model
* *
* @return TransactionJournal * @return TransactionJournal
*/ */
public static function routeBinder($guard, string $value): TransactionJournal public static function routeBinder(string $value): TransactionJournal
{ {
if ($guard->check()) { if ($guard->check()) {
$journalId = intval($value); $journalId = intval($value);

View File

@ -44,7 +44,7 @@ class TransactionJournalLink extends Model
* *
* @throws NotFoundHttpException * @throws NotFoundHttpException
*/ */
public static function routeBinder($guard, string $value): TransactionJournalLink public static function routeBinder(string $value): TransactionJournalLink
{ {
if ($guard->check()) { if ($guard->check()) {
$linkId = intval($value); $linkId = intval($value);

View File

@ -72,7 +72,7 @@ class TransactionType extends Model
* *
* @return Model|null|static * @return Model|null|static
*/ */
public static function routeBinder($guard, string $type): TransactionType public static function routeBinder(string $type): TransactionType
{ {
if (!$guard->check()) { if (!$guard->check()) {
throw new NotFoundHttpException(); throw new NotFoundHttpException();