belongsTo(User::class); } public function roles() { return $this->belongsToMany(Role::class, 'table') ->using(RolePivot::class) ->as('pivotName') ->withPivot(/*'field_1', 'field_2', ... */) ->withTimestamps(); } public function post() { return $this->hasOne(Post::class); } public function comments() { return $this->hasMany(Comment::class); } public function getIsAllowedToDeleteAttribute() { return $this->hasNoOne([ // Relations. ]); } }