belongsTo('FireflyIII\Models\BudgetLimit'); } /** * @return array */ public function getDates() { return ['created_at', 'updated_at', 'startdate', 'enddate']; } /** * @param $value */ public function setAmountAttribute($value) { $this->attributes['amount'] = strval(round($value, 2)); } public static function routeBinder($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; } }