mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-21 02:39:10 -04:00
ALPHA 3.0.2
This commit is contained in:
56
app/User.php
56
app/User.php
@@ -32,6 +32,13 @@ class User extends Authenticatable
|
||||
return $this->hasMany(Log::class);
|
||||
}
|
||||
|
||||
public function updateAPI()
|
||||
{
|
||||
$this->api_token = str_random(60);
|
||||
|
||||
$this->save();
|
||||
}
|
||||
|
||||
public function fullname()
|
||||
{
|
||||
$fullname = $this->lastname.' '.$this->firstname;
|
||||
@@ -42,4 +49,53 @@ class User extends Authenticatable
|
||||
{
|
||||
return $this->hasMany(Message::class);
|
||||
}
|
||||
|
||||
public function routeNotificationForNexmo($notification)
|
||||
{
|
||||
return $this->telephone;
|
||||
}
|
||||
|
||||
public function getPerm($perm)
|
||||
{
|
||||
$rank = \App\Rank::find($this->rank);
|
||||
$job = \App\Job::find($this->job);
|
||||
|
||||
$rank_perm_value = $rank->$perm;
|
||||
$job_perm_value = $job->$perm;
|
||||
$user_perm_value = $this->$perm;
|
||||
|
||||
if ($user_perm_value == 1 ) {
|
||||
$perm_value = 1;
|
||||
} else if ($job_perm_value== 1) {
|
||||
$perm_value = 1;
|
||||
} else if ($rank_perm_value == 1) {
|
||||
$perm_value = 1;
|
||||
} else {
|
||||
$perm_value = 0;
|
||||
}
|
||||
|
||||
dd($perm_value);
|
||||
}
|
||||
|
||||
public function getAcces($level)
|
||||
{
|
||||
$rank = \App\Rank::find($this->rank);
|
||||
$job = \App\Job::find($this->job);
|
||||
|
||||
$rank_perm_value = $rank->acces_level;
|
||||
$job_perm_value = $job->acces_level;
|
||||
$user_perm_value = $this->acces_level
|
||||
|
||||
if ($user_perm_value >= $level ) {
|
||||
$perm_value = true;
|
||||
} else if ($job_perm_value >= $level) {
|
||||
$perm_value = true;
|
||||
} else if ($rank_perm_value >= $level) {
|
||||
$perm_value = true;
|
||||
} else {
|
||||
$perm_value = false;
|
||||
}
|
||||
|
||||
return boolean $perm_value;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user