} } throw new NotFoundHttpException(); }); Route::bind('limitrepetition', function ($value) { if (Auth::check()) { $object = LimitRepetition::where('limit_repetitions.id', $value)->leftjoin('budget_limits', 'budget_limits.id', '=', 'limit_repetitions.budget_limit_id')->leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id')->where('budgets.user_id', Auth::user()->id)->first(['limit_repetitions.*']); if ($object) { return $object; } } throw new NotFoundHttpException(); }); Route::bind('piggyBank', function ($value) { if (Auth::check()) { $object = PiggyBank::where('piggy_banks.id', $value)->leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')->where('accounts.user_id', Auth::user()->id)->first(['piggy_banks.*']); if ($object) { return $object; } } throw new NotFoundHttpException(); }); Route::bind('category', function ($value) { if (Auth::check()) { $object = Category::where('id', $value)->where('user_id', Auth::user()->id)->first(); if ($object) { return $object; } } throw new NotFoundHttpException(); });
/** * @covers FireflyIII\Repositories\PiggyBank\PiggyBankRepository::reset */ public function testReset() { $piggyBank = FactoryMuffin::create('FireflyIII\\Models\\PiggyBank'); $piggyBank->order = 4; $piggyBank->save(); $this->be($piggyBank->account->user); $this->object->reset(); $this->assertCount(1, PiggyBank::where('order', 0)->get()); }