Would be nice to remove the references as well...

This commit is contained in:
James Cole
2018-02-09 19:28:16 +01:00
parent 0f09a9db4d
commit e69e6c1ce8
15 changed files with 28 additions and 28 deletions

View File

@@ -67,11 +67,11 @@ class PiggyBank extends Model
*/
public static function routeBinder(string $value): PiggyBank
{
if ($guard->check()) {
if (auth()->check()) {
$piggyBankId = intval($value);
$piggyBank = self::where('piggy_banks.id', $piggyBankId)
->leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')
->where('accounts.user_id', $guard->user()->id)->first(['piggy_banks.*']);
->where('accounts.user_id', auth()->user()->id)->first(['piggy_banks.*']);
if (!is_null($piggyBank)) {
return $piggyBank;
}