-
Notifications
You must be signed in to change notification settings - Fork 0
/
UserLevel.php
49 lines (40 loc) · 1.01 KB
/
UserLevel.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
namespace Modules\Core;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Vinkla\Hashids\Facades\Hashids;
class UserLevel extends Model
{
use SoftDeletes;
/**
* The attributes that should be mutated to dates.
*
* @var array
*/
protected $dates = ['deleted_at'];
protected $guarded = [];
protected $table = 'cwa_user_levels';
public function uniqueid()
{
$uniqueId = Hashids::encode($this->id);
return $uniqueId;
}
public static function originalid($value)
{
$originalId = Hashids::decode($value)[0];
return $originalId;
}
/**
* get list of user's feature access
* @param string $tag
* @return string|null
*/
public function getFeatureAccess($tag)
{
$features = json_decode($this->features, true);
if (isset($features[$tag])) {
return $features[$tag] === true ? " " : $features[$tag];
}
return null;
}
}