summaryrefslogtreecommitdiff
path: root/src/Models/User/User.php
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-10-06 14:15:54 +0200
committermsquare <msquare@notrademark.de>2018-10-31 13:43:23 +0100
commit8e62c4c52c27f9432820915deeb699c3d1f58ce7 (patch)
tree43d22891924aeaa42108c21309da6b09b5390128 /src/Models/User/User.php
parentb443b53919f50bd0176e7b67dfd1efc28276a770 (diff)
Added new user models
Diffstat (limited to 'src/Models/User/User.php')
-rw-r--r--src/Models/User/User.php96
1 files changed, 96 insertions, 0 deletions
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();
+ }
+}