42 lines
1015 B
PHP
42 lines
1015 B
PHP
<?php
|
|
|
|
namespace App\Livewire\Pages\Settings;
|
|
|
|
use Illuminate\View\View;
|
|
use Livewire\Component;
|
|
|
|
class Index extends Component
|
|
{
|
|
public string $workspaceName = '';
|
|
|
|
public string $workspaceSlug = '';
|
|
|
|
public function mount(): void
|
|
{
|
|
$ws = app('current_workspace');
|
|
$this->workspaceName = $ws->name;
|
|
$this->workspaceSlug = $ws->slug;
|
|
}
|
|
|
|
public function saveWorkspace(): void
|
|
{
|
|
$this->validate([
|
|
'workspaceName' => 'required|string|max:100',
|
|
'workspaceSlug' => 'nullable|string|max:50|alpha_dash',
|
|
]);
|
|
|
|
app('current_workspace')->update([
|
|
'name' => $this->workspaceName,
|
|
'slug' => $this->workspaceSlug ?: app('current_workspace')->slug,
|
|
]);
|
|
|
|
session()->flash('status', 'Workspace settings saved.');
|
|
}
|
|
|
|
public function render(): View
|
|
{
|
|
return view('livewire.pages.settings.index')
|
|
->layout('layouts.nimuli-app', ['title' => 'Settings']);
|
|
}
|
|
}
|