update models with defaults

This commit is contained in:
Xu 2023-08-29 17:43:45 +02:00 committed by Igor Scheller
parent 1ca9b99612
commit f3ec62e121
12 changed files with 73 additions and 15 deletions

View File

@ -30,6 +30,13 @@ class OAuth extends BaseModel
public $table = 'oauth'; // phpcs:ignore
/** @var array<string, null> default attributes */
protected $attributes = [ // phpcs:ignore
'access_token' => null,
'refresh_token' => null,
'expires_at' => null,
];
/** @var bool Enable timestamps */
public $timestamps = true; // phpcs:ignore

View File

@ -36,6 +36,13 @@ class Question extends BaseModel
/** @var bool Enable timestamps */
public $timestamps = true; // phpcs:ignore
/** @var array<string, null> default attributes */
protected $attributes = [ // phpcs:ignore
'answer' => null,
'answerer_id' => null,
'answered_at' => null,
];
/** @var array<string> */
protected $dates = [ // phpcs:ignore
'answered_at',

View File

@ -39,6 +39,13 @@ class Room extends BaseModel
/** @var bool Enable timestamps */
public $timestamps = true; // phpcs:ignore
/** @var array<string, null> default attributes */
protected $attributes = [ // phpcs:ignore
'map_url' => null,
'description' => null,
'dect' => null,
];
/** @var array<string> */
protected $fillable = [ // phpcs:ignore
'name',

View File

@ -32,6 +32,12 @@ class NeededAngelType extends BaseModel
{
use HasFactory;
/** @var array<string, null> default attributes */
protected $attributes = [ // phpcs:ignore
'room_id' => null,
'shift_id' => null,
];
/** @var array<string> */
protected $fillable = [ // phpcs:ignore
'room_id',
@ -40,12 +46,6 @@ class NeededAngelType extends BaseModel
'count',
];
/** @var array<string, null> default attributes */
protected $attributes = [ // phpcs:ignore
'room_id' => null,
'shift_id' => null,
];
public function room(): BelongsTo
{
return $this->belongsTo(Room::class);

View File

@ -56,6 +56,14 @@ class Shift extends BaseModel
{
use HasFactory;
/** @var array<string, string|null> default attributes */
protected $attributes = [ // phpcs:ignore
'description' => '',
'url' => '',
'transaction_id' => null,
'updated_by' => null,
];
/** @var bool enable timestamps */
public $timestamps = true; // phpcs:ignore

View File

@ -34,6 +34,13 @@ class ShiftEntry extends BaseModel
use HasFactory;
use UsesUserModel;
/** @var array<string, string|bool> default attributes */
protected $attributes = [ // phpcs:ignore
'user_comment' => '',
'freeloaded' => false,
'freeloaded_comment' => '',
];
/** @var array<string> */
protected $fillable = [ // phpcs:ignore
'shift_id',
@ -44,13 +51,6 @@ class ShiftEntry extends BaseModel
'freeloaded_comment',
];
/** @var array<string, string|bool> default attributes */
protected $attributes = [ // phpcs:ignore
'user_comment' => '',
'freeloaded' => false,
'freeloaded_comment' => '',
];
/** @var array<string, string> */
protected $casts = [ // phpcs:ignore
'freeloaded' => 'bool',

View File

@ -20,6 +20,13 @@ class Contact extends HasUserModel
{
use HasFactory;
/** @var array<string, null> default attributes */
protected $attributes = [ // phpcs:ignore
'dect' => null,
'mobile' => null,
'email' => null,
];
/** @var string The table associated with the model */
protected $table = 'users_contact'; // phpcs:ignore

View File

@ -33,7 +33,7 @@ class License extends HasUserModel
/** @var string The table associated with the model */
protected $table = 'users_licenses'; // phpcs:ignore
/** @var array Default attributes */
/** @var array<string, bool> Default attributes */
protected $attributes = [ // phpcs:ignore
'has_car' => false,
'drive_forklift' => false,

View File

@ -30,6 +30,16 @@ class PersonalData extends HasUserModel
/** @var string The table associated with the model */
protected $table = 'users_personal_data'; // phpcs:ignore
/** @var array<string, null> default attributes */
protected $attributes = [ // phpcs:ignore
'first_name' => null,
'last_name' => null,
'pronoun' => null,
'shirt_size' => null,
'planned_arrival_date' => null,
'planned_departure_date' => null,
];
/** @var array<string> The attributes that should be mutated to dates */
protected $dates = [ // phpcs:ignore
'planned_arrival_date',

View File

@ -30,9 +30,10 @@ class State extends HasUserModel
/** @var string The table associated with the model */
protected $table = 'users_state'; // phpcs:ignore
/** @var array<string, bool|int> Default attributes */
/** @var array<string, bool|int|null> Default attributes */
protected $attributes = [ // phpcs:ignore
'arrived' => false,
'arrival_date' => null,
'active' => false,
'force_active' => false,
'got_shirt' => false,

View File

@ -78,6 +78,11 @@ class User extends BaseModel
/** @var bool enable timestamps */
public $timestamps = true; // phpcs:ignore
/** @var array<string, null> default attributes */
protected $attributes = [ // phpcs:ignore
'last_login_at' => null,
];
/**
* The attributes that are mass assignable.
*

View File

@ -39,6 +39,12 @@ class UserAngelType extends Pivot
/** @var bool Disable timestamps */
public $timestamps = false; // phpcs:ignore
/** @var array<string, null|bool> default attributes */
protected $attributes = [ // phpcs:ignore
'confirm_user_id' => null,
'supporter' => false,
];
/** @var array<string> */
protected $fillable = [ // phpcs:ignore
'user_id',