'integer', 'schedule_id' => 'integer', 'sequence_id' => 'integer', 'time_offset' => 'integer', 'is_queued' => 'boolean', 'continue_on_failure' => 'boolean', ]; /** * Default attributes when creating a new model. */ protected $attributes = [ 'time_offset' => 0, 'is_queued' => false, 'continue_on_failure' => false, ]; public static array $validationRules = [ 'schedule_id' => 'required|numeric|exists:schedules,id', 'sequence_id' => 'required|numeric|min:1', 'action' => 'required|string', 'payload' => 'required_unless:action,backup|string', 'time_offset' => 'required|numeric|between:0,900', 'is_queued' => 'boolean', 'continue_on_failure' => 'boolean', ]; /** * {@inheritDoc} */ public function getRouteKeyName(): string { return $this->getKeyName(); } /** * Return a hashid encoded string to represent the ID of the task. */ public function getHashidAttribute(): string { return Container::getInstance()->make(HashidsInterface::class)->encode($this->id); } /** * Return the schedule that a task belongs to. */ public function schedule(): BelongsTo { return $this->belongsTo(Schedule::class); } /** * Return the server a task is assigned to, acts as a belongsToThrough. */ public function server(): \Znck\Eloquent\Relations\BelongsToThrough { return $this->belongsToThrough(Server::class, Schedule::class); } }