How to add new field in "servers" table? #3278
rasm945i
started this conversation in
General Community
Replies: 1 comment
-
you would need to add a migration. take a look at pterodactyl's existing migrations to see how they work |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
It's probably very simple, but I'm trying to add a new field in the "servers" table, a "next_checkup" field.
I've looked far and wide across a bunch of files, also tried editing a few, but with no luck. It's probably some Laravel thing that I need to know, but I have no clue what to search for as I've already tried.
I'd like the value included in API requests. I've tried the following so far, without luck:
Had a glance at ServerTransformer.php in /app/Transformers/Api/ (Client/Application) folders. It seems like I need to do something in here.
In app/Models/Server.php
Added * @property \Carbon\Carbon $next_checkup
under the other @property things with dates
Added public const NEXT_CHECKUP = self::UPDATED_AT; and I honestly have no clue if that works as I think it should (sets the default value to the same as updated_at)
Included the "next_checkup" field on the following lines:
protected $dates = [self::CREATED_AT, self::UPDATED_AT, self::NEXT_CHECKUP, 'deleted_at'];
protected $guarded = ['id', self::CREATED_AT, self::UPDATED_AT, self::NEXT_CHECKUP, 'deleted_at'];
Added 'next_checkup' => 'present|nullable|date' at the bottom of the $validationRules map
Added 'next_checkup' => 'date', in the $casts map
Whenever I've tried something new, I run the following commands to make sure it is up-to-date
And yes, I'm kinda just throwing spaghetti at the wall hoping it sticks since I'm unsure where to start and what to look out for. Any help is greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions