update: super-admin page

This commit is contained in:
Cauê Faleiros
2026-02-03 11:32:40 -03:00
parent e9333c8341
commit c93a0af3d7
7 changed files with 57 additions and 29 deletions

View File

@@ -41,6 +41,33 @@ class TenantController extends Controller
->with('success', 'Tenant created successfully.');
}
public function edit($id)
{
$tenant = Tenant::findOrFail($id);
return view('super-admin.tenants.edit', compact('tenant'));
}
public function update(Request $request, $id)
{
$tenant = Tenant::findOrFail($id);
$validated = $request->validate([
'domain' => 'required|string|unique:mysql.domains,domain,' . $tenant->domains->first()->id,
]);
// Update domain
$tenant->domains()->update([
'domain' => $validated['domain'],
]);
$tenant->update([
'last_updated_by' => Auth::user()->name ?? 'Super Admin',
]);
return redirect()->route('super-admin.tenants.index')
->with('success', 'Tenant updated successfully.');
}
public function destroy($id)
{
$tenant = Tenant::findOrFail($id);