Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/Enums/SystemThemesEnum.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Native\Laravel\Enums;

enum SystemThemesEnum: string
{
case SYSTEM = 'system';
case LIGHT = 'light';
case DARK = 'dark';
}
2 changes: 2 additions & 0 deletions src/Facades/System.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Native\Laravel\Facades;

use Illuminate\Support\Facades\Facade;
use Native\Laravel\Enums\SystemThemesEnum;

/**
* @method static bool canPromptTouchID()
Expand All @@ -14,6 +15,7 @@
* @method static void print(string $html, ?\Native\Laravel\DataObjects\Printer $printer = null)
* @method static string printToPDF(string $reason)
* @method static string timezone()
* @method static SystemThemesEnum theme(?SystemThemesEnum $theme = null)
*/
class System extends Facade
{
Expand Down
14 changes: 14 additions & 0 deletions src/System.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Native\Laravel\Client\Client;
use Native\Laravel\DataObjects\Printer;
use Native\Laravel\Enums\SystemThemesEnum;
use Native\Laravel\Support\Environment;
use Native\Laravel\Support\Timezones;

Expand Down Expand Up @@ -88,4 +89,17 @@ public function timezone(): string

return $timezone;
}

public function theme(?SystemThemesEnum $theme = null): SystemThemesEnum
{
if ($theme) {
$result = $this->client->post('system/theme', [
'theme' => $theme,
])->json('result');
} else {
$result = $this->client->get('system/theme')->json('result');
}

return SystemThemesEnum::from($result);
}
}
Loading