summaryrefslogtreecommitdiff
path: root/src/Models/User/HasUserModel.php
blob: 4c2e15b042739742aeffbc5feabb774a37db5148 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php

namespace Engelsystem\Models\User;

use Engelsystem\Models\BaseModel;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Query\Builder as QueryBuilder;

/**
 * @property integer                $user_id
 *
 * @property-read QueryBuilder|User $user
 *
 * @method static QueryBuilder|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',
    ];

    /** The relationships that should be touched on save */
    protected $touches = ['user'];

    /**
     * @return BelongsTo
     */
    public function user()
    {
        return $this->belongsTo(User::class);
    }
}