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; } /** * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function budgetLimit() { return $this->belongsTo('FireflyIII\Models\BudgetLimit'); } /** * @param $value */ public function setAmountAttribute($value) { $this->attributes['amount'] = strval(round($value, 2)); } }