⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.19
Server IP:
178.33.27.10
Server:
Linux cpanel.dev-unit.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
Server Software:
Apache/2.4.57 (Unix) OpenSSL/1.0.2k-fips
PHP Version:
8.2.11
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
id
/
dalily-1.dev-unit.com
/
app
/
Models
/
View File Name :
Admin.php
<?php namespace App\Models; use App\Notifications\AdminResetPasswordNotification; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; use Illuminate\Support\Facades\DB; use Spatie\Permission\Traits\HasRoles; class Admin extends Authenticatable { use HasFactory, HasRoles, Notifiable; protected $guard = 'admin'; /** * The attributes that are mass assignable. * * @var array */ protected $guarded = []; /** * The attributes that should be hidden for arrays. * * @var array */ protected $hidden = [ 'password', 'remember_token', ]; /** * The attributes that should be cast to native types. * * @var array */ protected $casts = [ 'email_verified_at' => 'datetime', ]; public static function getPermissionGroup() { $permission_group = DB::table('permissions') ->select('group_name as name') ->groupBy('group_name') ->get(); return $permission_group; } public static function getpermissionsByGroupName($group_name) { $permissions = DB::table('permissions') ->select('name', 'id') ->where('group_name', $group_name) ->get(); return $permissions; } public static function roleHasPermission($role, $permissions) { $hasPermission = true; foreach ($permissions as $permission) { if (! $role->hasPermissionTo($permission->name)) { $hasPermission = false; return $hasPermission; } } return $hasPermission; } /** * Backend user image url * * @return string */ public function getImageUrlAttribute() { $image = $this->image; if ($image) { return asset($image); } else { return '/backend/image/default-user.png'; } } /** * Send a password reset notification to the user. * * @param string $token * @return void */ public function sendPasswordResetNotification($token) { $this->notify(new AdminResetPasswordNotification($token)); } }