'required|exists:components,id', 'startdate' => 'required|date', 'amount' => 'numeric|required|min:0.01', 'repeats' => 'required|between:0,1', 'repeat_freq' => 'required|in:daily,weekly,monthly,quarterly,half-year,yearly' ]; public static function factory() { $start = new Carbon\Carbon; $start->startOfMonth(); return [ 'component_id' => 'factory|Budget', 'startdate' => $start, 'amount' => '100', 'repeats' => 0, 'repeat_freq' => 'monthly' ]; } public function component() { return $this->belongsTo('Component', 'component_id'); } public function budget() { return $this->belongsTo('Budget', 'component_id'); } public function limitrepetitions() { return $this->hasMany('LimitRepetition'); } public function getDates() { return ['created_at', 'updated_at', 'startdate', 'enddate']; } }