-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c6081b4
commit a4bd787
Showing
4 changed files
with
71 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,8 +9,9 @@ | |
* @package Arcanesoft\Auth\Models | ||
* @author ARCANEDEV <[email protected]> | ||
* | ||
* @method static \Illuminate\Database\Eloquent\Builder admins() | ||
* @method static \Illuminate\Database\Eloquent\Builder members() | ||
* @method static \Illuminate\Database\Eloquent\Builder admin() | ||
* @method static \Illuminate\Database\Eloquent\Builder moderator() | ||
* @method static \Illuminate\Database\Eloquent\Builder member() | ||
*/ | ||
class Role extends BaseRoleModel | ||
{ | ||
|
@@ -33,7 +34,7 @@ class Role extends BaseRoleModel | |
* | ||
* @return \Illuminate\Database\Eloquent\Builder | ||
*/ | ||
public function scopeAdmins(Builder $query) | ||
public function scopeAdmin(Builder $query) | ||
{ | ||
return $query->where('slug', Role::ADMINISTRATOR); | ||
} | ||
|
@@ -57,7 +58,7 @@ public function scopeModerator(Builder $query) | |
* | ||
* @return \Illuminate\Database\Eloquent\Builder | ||
*/ | ||
public function scopeMembers(Builder $query) | ||
public function scopeMember(Builder $query) | ||
{ | ||
return $query->where('slug', Role::MEMBER); | ||
} | ||
|
@@ -73,7 +74,7 @@ public function scopeMembers(Builder $query) | |
*/ | ||
public function getHashedIdAttribute() | ||
{ | ||
return hasher()->encode($this->id); | ||
return self::hasher()->encode($this->id); | ||
} | ||
|
||
/* ------------------------------------------------------------------------------------------------ | ||
|
@@ -91,7 +92,7 @@ public function getHashedIdAttribute() | |
*/ | ||
public static function firstHashedOrFail($hashedId) | ||
{ | ||
$id = head(hasher()->decode($hashedId)); | ||
$id = self::hasher()->decode($hashedId); | ||
|
||
return self::where('id', $id)->firstOrFail(); | ||
} | ||
|
@@ -105,4 +106,18 @@ public function makeSlugName($value) | |
{ | ||
return $this->slugify($value); | ||
} | ||
|
||
/* ------------------------------------------------------------------------------------------------ | ||
| Other Functions | ||
| ------------------------------------------------------------------------------------------------ | ||
*/ | ||
/** | ||
* Get the hasher. | ||
* | ||
* @return \Arcanedev\Hasher\Contracts\HashManager | ||
*/ | ||
protected static function hasher() | ||
{ | ||
return hasher(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters