adrema/app/Setting/NamiSettings.php

33 lines
581 B
PHP
Raw Normal View History

2022-02-19 15:18:24 +01:00
<?php
namespace App\Setting;
use App\Group;
2022-02-19 15:18:24 +01:00
use Spatie\LaravelSettings\Settings;
2022-02-19 18:06:07 +01:00
use Zoomyboy\LaravelNami\Api;
use Zoomyboy\LaravelNami\Nami;
2022-02-19 15:18:24 +01:00
class NamiSettings extends Settings
{
public int $mglnr;
public string $password;
2022-05-01 21:00:15 +02:00
public int $default_group_id;
2022-02-19 15:18:24 +01:00
public static function group(): string
{
return 'nami';
}
2022-02-19 18:06:07 +01:00
public function login(): Api
{
return Nami::login($this->mglnr, $this->password);
}
public function localGroup(): ?Group
{
return Group::firstWhere('nami_id', $this->default_group_id);
}
2022-02-19 15:18:24 +01:00
}