summaryrefslogtreecommitdiff
path: root/src/Models/User
diff options
context:
space:
mode:
Diffstat (limited to 'src/Models/User')
-rw-r--r--src/Models/User/Contact.php26
-rw-r--r--src/Models/User/HasUserModel.php30
-rw-r--r--src/Models/User/PasswordReset.php25
-rw-r--r--src/Models/User/PersonalData.php42
-rw-r--r--src/Models/User/Settings.php29
-rw-r--r--src/Models/User/State.php32
-rw-r--r--src/Models/User/User.php96
7 files changed, 280 insertions, 0 deletions
diff --git a/src/Models/User/Contact.php b/src/Models/User/Contact.php
new file mode 100644
index 00000000..8adf9df7
--- /dev/null
+++ b/src/Models/User/Contact.php
@@ -0,0 +1,26 @@
+<?php
+
+namespace Engelsystem\Models\User;
+
+/**
+ * @property string $dect
+ * @property string $email
+ * @property string $mobile
+ *
+ * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\Contact whereDect($value)
+ * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\Contact whereEmail($value)
+ * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\Contact whereMobile($value)
+ */
+class Contact extends HasUserModel
+{
+ /** @var string The table associated with the model */
+ protected $table = 'users_contact';
+
+ /** The attributes that are mass assignable */
+ protected $fillable = [
+ 'user_id',
+ 'dect',
+ 'email',
+ 'mobile',
+ ];
+}
diff --git a/src/Models/User/HasUserModel.php b/src/Models/User/HasUserModel.php
new file mode 100644
index 00000000..89dbd642
--- /dev/null
+++ b/src/Models/User/HasUserModel.php
@@ -0,0 +1,30 @@
+<?php
+
+namespace Engelsystem\Models\User;
+
+use Engelsystem\Models\BaseModel;
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
+
+/**
+ * @property integer $user_id
+ *
+ * @method static \Illuminate\Database\Query\Builder|static whereUserId($value)
+ */
+abstract class HasUserModel extends BaseModel
+{
+ /** @var string The primary key for the model */
+ protected $primaryKey = 'user_id';
+
+ /** The attributes that are mass assignable */
+ protected $fillable = [
+ 'user_id',
+ ];
+
+ /**
+ * @return BelongsTo
+ */
+ public function user()
+ {
+ return $this->belongsTo(User::class);
+ }
+}
diff --git a/src/Models/User/PasswordReset.php b/src/Models/User/PasswordReset.php
new file mode 100644
index 00000000..b65258c5
--- /dev/null
+++ b/src/Models/User/PasswordReset.php
@@ -0,0 +1,25 @@
+<?php
+
+namespace Engelsystem\Models\User;
+
+/**
+ * @property string $token
+ * @property \Carbon\Carbon $created_at
+ *
+ * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\PasswordReset whereToken($value)
+ * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\PasswordReset whereCreatedAt($value)
+ */
+class PasswordReset extends HasUserModel
+{
+ /** @var bool enable timestamps for created_at */
+ public $timestamps = true;
+
+ /** @var null Disable updated_at */
+ const UPDATED_AT = null;
+
+ /** The attributes that are mass assignable */
+ protected $fillable = [
+ 'user_id',
+ 'token',
+ ];
+}
diff --git a/src/Models/User/PersonalData.php b/src/Models/User/PersonalData.php
new file mode 100644
index 00000000..bdd0bafb
--- /dev/null
+++ b/src/Models/User/PersonalData.php
@@ -0,0 +1,42 @@
+<?php
+
+namespace Engelsystem\Models\User;
+
+/**
+ * @property string $first_name
+ * @property string $last_name
+ * @property string $shirt_size
+ * @property \Carbon\Carbon $arrival_date
+ * @property \Carbon\Carbon $planned_arrival_date
+ * @property \Carbon\Carbon $planned_departure_date
+ *
+ * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\PersonalData whereFirstName($value)
+ * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\PersonalData whereLastName($value)
+ * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\PersonalData whereShirtSize($value)
+ * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\PersonalData whereArrivalDate($value)
+ * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\PersonalData wherePlannedArrivalDate($value)
+ * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\PersonalData wherePlannedDepartureDate($value)
+ */
+class PersonalData extends HasUserModel
+{
+ /** @var string The table associated with the model */
+ protected $table = 'users_personal_data';
+
+ /** @var array The attributes that should be mutated to dates */
+ protected $dates = [
+ 'arrival_date',
+ 'planned_arrival_date',
+ 'planned_departure_date',
+ ];
+
+ /** The attributes that are mass assignable. */
+ protected $fillable = [
+ 'user_id',
+ 'first_name',
+ 'last_name',
+ 'shirt_size',
+ 'arrival_date',
+ 'planned_arrival_date',
+ 'planned_departure_date',
+ ];
+}
diff --git a/src/Models/User/Settings.php b/src/Models/User/Settings.php
new file mode 100644
index 00000000..8f86e123
--- /dev/null
+++ b/src/Models/User/Settings.php
@@ -0,0 +1,29 @@
+<?php
+
+namespace Engelsystem\Models\User;
+
+/**
+ * @property string $language
+ * @property int $theme
+ * @property bool $email_human
+ * @property bool $email_shiftinfo
+ *
+ * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\Settings whereLanguage($value)
+ * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\Settings whereTheme($value)
+ * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\Settings whereEmailHuman($value)
+ * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\Settings whereEmailShiftinfo($value)
+ */
+class Settings extends HasUserModel
+{
+ /** @var string The table associated with the model */
+ protected $table = 'users_settings';
+
+ /** The attributes that are mass assignable */
+ protected $fillable = [
+ 'user_id',
+ 'language',
+ 'theme',
+ 'email_human',
+ 'email_shiftinfo',
+ ];
+}
diff --git a/src/Models/User/State.php b/src/Models/User/State.php
new file mode 100644
index 00000000..6a1876ed
--- /dev/null
+++ b/src/Models/User/State.php
@@ -0,0 +1,32 @@
+<?php
+
+namespace Engelsystem\Models\User;
+
+/**
+ * @property bool $arrived
+ * @property bool $active
+ * @property bool $force_active
+ * @property bool $got_shirt
+ * @property int $got_voucher
+ *
+ * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\State whereArrived($value)
+ * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\State whereActive($value)
+ * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\State whereForceActive($value)
+ * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\State whereGotShirt($value)
+ * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\State whereGotVoucher($value)
+ */
+class State extends HasUserModel
+{
+ /** @var string The table associated with the model */
+ protected $table = 'users_state';
+
+ /** The attributes that are mass assignable */
+ protected $fillable = [
+ 'user_id',
+ 'arrived',
+ 'active',
+ 'force_active',
+ 'got_shirt',
+ 'got_voucher',
+ ];
+}
diff --git a/src/Models/User/User.php b/src/Models/User/User.php
new file mode 100644
index 00000000..d2a5129d
--- /dev/null
+++ b/src/Models/User/User.php
@@ -0,0 +1,96 @@
+<?php
+
+namespace Engelsystem\Models\User;
+
+use Engelsystem\Models\BaseModel;
+use Illuminate\Database\Eloquent\Relations\HasOne;
+
+/**
+ * @property integer $id
+ * @property string $name
+ * @property string $email
+ * @property string $password
+ * @property string $api_key
+ * @property \Carbon\Carbon $last_login_at
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ *
+ * @property-read \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\Contact $contact
+ * @property-read \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\PersonalData $personalData
+ * @property-read \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\Settings $settings
+ * @property-read \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\State $state
+ *
+ * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\User whereId($value)
+ * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\User whereName($value)
+ * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\User whereEmail($value)
+ * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\User wherePassword($value)
+ * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\User whereApiKey($value)
+ * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\User whereLastLoginAt($value)
+ * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\User whereCreatedAt($value)
+ * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\User whereUpdatedAt($value)
+ */
+class User extends BaseModel
+{
+ /** @var bool enable timestamps */
+ public $timestamps = true;
+
+ /** The attributes that are mass assignable */
+ protected $fillable = [
+ 'name',
+ 'password',
+ 'email',
+ 'api_key',
+ 'last_login_at',
+ ];
+
+ /** @var array The attributes that should be hidden for serialization */
+ protected $hidden = [
+ 'api_key',
+ 'password',
+ ];
+
+ /** @var array The attributes that should be mutated to dates */
+ protected $dates = [
+ 'last_login_at',
+ ];
+
+ /**
+ * @return HasOne
+ */
+ public function contact()
+ {
+ return $this
+ ->hasOne(Contact::class)
+ ->withDefault();
+ }
+
+ /**
+ * @return HasOne
+ */
+ public function personalData()
+ {
+ return $this
+ ->hasOne(PersonalData::class)
+ ->withDefault();
+ }
+
+ /**
+ * @return HasOne
+ */
+ public function settings()
+ {
+ return $this
+ ->hasOne(Settings::class)
+ ->withDefault();
+ }
+
+ /**
+ * @return HasOne
+ */
+ public function state()
+ {
+ return $this
+ ->hasOne(State::class)
+ ->withDefault();
+ }
+}