Skip to content
This repository has been archived by the owner on Mar 18, 2022. It is now read-only.

Reference addition to auth model for L5.2 #157

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/Bican/Roles/Traits/RoleHasRelations.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ public function permissions()
*/
public function users()
{
return $this->belongsToMany(config('auth.model'))->withTimestamps();
if(isset(config('auth.model'))){
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if(config('auth.model') !== null) {

return $this->belongsToMany(config('auth.model'))->withTimestamps();
}
if(isset(config('auth.providers.users.model'))){
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if(config('auth.providers.users.model') !== null){

return $this->belongsToMany(config('auth.providers.users.model'))->withTimestamps();
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// return null, if config("auth.model") OR config("auth.providers.users.model") is not found
return null;

}

/**
Expand Down