add budgets
This commit is contained in:
@@ -8,6 +8,7 @@ use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
class Admin extends Authenticatable
|
||||
{
|
||||
@@ -155,4 +156,15 @@ class Admin extends Authenticatable
|
||||
{
|
||||
return $this->hasOne(UserHasCabang::class, 'user_id')->with('cabang');
|
||||
}
|
||||
|
||||
public static function getUserByRoleName($roleName)
|
||||
{
|
||||
$role = Role::where('name', $roleName)->first();
|
||||
|
||||
if ($role) {
|
||||
return $role->users()->with('cabang')->get();
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user