adrema/app/Setting/NamiSettings.php

59 lines
1.1 KiB
PHP
Raw Normal View History

2022-02-19 15:18:24 +01:00
<?php
namespace App\Setting;
use App\Group;
2023-10-31 00:11:32 +01:00
use App\Nami\Actions\SettingIndexAction;
use App\Nami\Actions\SettingSaveAction;
2024-08-01 10:25:48 +02:00
use App\Setting\Contracts\Viewable;
2023-10-31 00:11:32 +01:00
use App\Setting\Contracts\Storeable;
2022-02-19 18:06:07 +01:00
use Zoomyboy\LaravelNami\Api;
use Zoomyboy\LaravelNami\Nami;
2022-02-19 15:18:24 +01:00
2024-08-01 10:25:48 +02:00
class NamiSettings extends LocalSettings implements Viewable, Storeable
2022-02-19 15:18:24 +01:00
{
public int $mglnr;
public string $password;
2022-05-01 21:00:15 +02:00
public int $default_group_id;
2023-05-08 15:11:16 +02:00
/** @var array<string, string> */
public array $search_params;
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);
}
2023-10-31 00:11:32 +01:00
public static function slug(): string
{
return 'nami';
}
public static function indexAction(): string
{
return SettingIndexAction::class;
}
public static function storeAction(): string
{
return SettingSaveAction::class;
}
public static function title(): string
{
return 'NaMi-Login';
}
2022-02-19 15:18:24 +01:00
}