Skip to content

Commit 2e85ed1

Browse files
committed
Merge branch 'main' of github.com:NativePHP/laravel
2 parents 7b0b3d0 + 1d477ba commit 2e85ed1

File tree

7 files changed

+88
-5
lines changed

7 files changed

+88
-5
lines changed

.github/workflows/dependabot-auto-merge.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313

1414
- name: Dependabot metadata
1515
id: metadata
16-
uses: dependabot/fetch-metadata@v1.5.1
16+
uses: dependabot/fetch-metadata@v1.6.0
1717
with:
1818
github-token: "${{ secrets.GITHUB_TOKEN }}"
1919

src/Dialog.php

+10-1
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,22 @@ public function withHiddenFiles()
7070
return $this;
7171
}
7272

73-
public function singleFile()
73+
public function files()
7474
{
75+
$this->properties = array_diff($this->properties, ['openDirectory']);
7576
$this->properties = ['openFile'];
7677

7778
return $this;
7879
}
7980

81+
public function folders()
82+
{
83+
$this->properties = array_diff($this->properties, ['openFile']);
84+
$this->properties[] = 'openDirectory';
85+
86+
return $this;
87+
}
88+
8089
public function dontResolveSymlinks(): self
8190
{
8291
$this->properties[] = 'noResolveAliases';
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace Native\Laravel\Events\Settings;
4+
5+
use Illuminate\Broadcasting\Channel;
6+
use Illuminate\Broadcasting\InteractsWithSockets;
7+
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
8+
use Illuminate\Foundation\Events\Dispatchable;
9+
use Illuminate\Queue\SerializesModels;
10+
11+
class SettingChanged implements ShouldBroadcastNow
12+
{
13+
use Dispatchable, InteractsWithSockets, SerializesModels;
14+
15+
public function __construct(public string $key, public mixed $value)
16+
{
17+
18+
}
19+
20+
public function broadcastOn()
21+
{
22+
return [
23+
new Channel('nativephp'),
24+
];
25+
}
26+
}

src/Facades/Settings.php

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace Native\Laravel\Facades;
4+
5+
use Illuminate\Support\Facades\Facade;
6+
7+
class Settings extends Facade
8+
{
9+
protected static function getFacadeAccessor()
10+
{
11+
return \Native\Laravel\Settings::class;
12+
}
13+
}

src/Menu/Menu.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,17 @@ public function label(string $label): self
6666
return $this->add(new Label($label));
6767
}
6868

69-
public function checkbox(string $label, bool $checked = false, ?string $hotkey = null): self
69+
public function checkbox(string $label, bool $checked = false, string $hotkey = null): self
7070
{
7171
return $this->add(new Checkbox($label, $checked, $hotkey));
7272
}
7373

74-
public function event(string $event, string $text, ?string $hotkey = null): self
74+
public function event(string $event, string $text, string $hotkey = null): self
7575
{
7676
return $this->add(new Event($event, $text, $hotkey));
7777
}
7878

79-
public function link(string $url, string $text, ?string $hotkey = null): self
79+
public function link(string $url, string $text, string $hotkey = null): self
8080
{
8181
return $this->add(new Link($url, $text, $hotkey));
8282
}

src/Settings.php

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace Native\Laravel;
4+
5+
use Native\Laravel\Client\Client;
6+
7+
class Settings
8+
{
9+
public function __construct(protected Client $client)
10+
{
11+
}
12+
13+
public function set($key, $value): void
14+
{
15+
$this->client->post('settings/'.$key, [
16+
'value' => $value,
17+
]);
18+
}
19+
20+
public function get($key, $default = null): mixed
21+
{
22+
return $this->client->get('settings/'.$key)->json('value') ?? $default;
23+
}
24+
}

src/Windows/Window.php

+11
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ class Window
1717

1818
protected bool $alwaysOnTop = false;
1919

20+
protected bool $showDevTools = false;
21+
2022
protected bool $resizable = true;
2123

2224
protected bool $movable = true;
@@ -46,6 +48,7 @@ public function __construct(string $id)
4648
$this->id = $id;
4749
$this->title = config('app.name');
4850
$this->url = url('/');
51+
$this->showDevTools = config('app.debug');
4952
}
5053

5154
public function id(string $id = 'main'): self
@@ -126,6 +129,13 @@ public function alwaysOnTop($alwaysOnTop = true): self
126129
return $this;
127130
}
128131

132+
public function showDevTools($showDevTools = true): self
133+
{
134+
$this->showDevTools = $showDevTools;
135+
136+
return $this;
137+
}
138+
129139
public function resizable($resizable = true): static
130140
{
131141
$this->resizable = $resizable;
@@ -188,6 +198,7 @@ public function toArray()
188198
'hasShadow' => $this->hasShadow,
189199
'frame' => $this->frame,
190200
'titleBarStyle' => $this->titleBarStyle,
201+
'showDevTools' => $this->showDevTools,
191202
'vibrancy' => $this->vibrancy,
192203
'transparency' => $this->transparent,
193204
'backgroundColor' => $this->backgroundColor,

0 commit comments

Comments
 (0)