diff --git a/src/Models/User/HasUserModel.php b/src/Models/User/HasUserModel.php index 6d1323de..2b7fdda9 100644 --- a/src/Models/User/HasUserModel.php +++ b/src/Models/User/HasUserModel.php @@ -3,17 +3,11 @@ namespace Engelsystem\Models\User; use Engelsystem\Models\BaseModel; -use Illuminate\Database\Eloquent\Relations\BelongsTo; -/** - * @property integer $user_id - * - * @property-read \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\User $user - * - * @method static \Illuminate\Database\Query\Builder|static whereUserId($value) - */ abstract class HasUserModel extends BaseModel { + use UsesUserModel; + /** @var string The primary key for the model */ protected $primaryKey = 'user_id'; @@ -24,12 +18,4 @@ abstract class HasUserModel extends BaseModel /** The relationships that should be touched on save */ protected $touches = ['user']; - - /** - * @return BelongsTo - */ - public function user() - { - return $this->belongsTo(User::class); - } } diff --git a/src/Models/User/UsesUserModel.php b/src/Models/User/UsesUserModel.php new file mode 100644 index 00000000..84795480 --- /dev/null +++ b/src/Models/User/UsesUserModel.php @@ -0,0 +1,25 @@ +belongsTo(User::class); + } +} diff --git a/tests/Unit/Models/User/Stub/HasUserModelImplementation.php b/tests/Unit/Models/User/Stub/HasUserModelImplementation.php deleted file mode 100644 index 6d442bdd..00000000 --- a/tests/Unit/Models/User/Stub/HasUserModelImplementation.php +++ /dev/null @@ -1,9 +0,0 @@ -assertInstanceOf(BelongsTo::class, $model->user()); }