Compare commits
3 Commits
908bb05362
...
c93a0af3d7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c93a0af3d7 | ||
|
|
e9333c8341 | ||
|
|
1741f5cd35 |
@@ -41,6 +41,33 @@ class TenantController extends Controller
|
|||||||
->with('success', 'Tenant created successfully.');
|
->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)
|
public function destroy($id)
|
||||||
{
|
{
|
||||||
$tenant = Tenant::findOrFail($id);
|
$tenant = Tenant::findOrFail($id);
|
||||||
|
|||||||
@@ -30,13 +30,13 @@ class Kernel extends HttpKernel
|
|||||||
*/
|
*/
|
||||||
protected $middlewareGroups = [
|
protected $middlewareGroups = [
|
||||||
'web' => [
|
'web' => [
|
||||||
\App\Http\Middleware\UniversalTenancy::class,
|
|
||||||
\App\Http\Middleware\EncryptCookies::class,
|
\App\Http\Middleware\EncryptCookies::class,
|
||||||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||||
\Illuminate\Session\Middleware\StartSession::class,
|
\Illuminate\Session\Middleware\StartSession::class,
|
||||||
// \Illuminate\Session\Middleware\AuthenticateSession::class,
|
// \Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||||
|
\App\Http\Middleware\UniversalTenancy::class,
|
||||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|||||||
@@ -5,10 +5,15 @@ version: "3.7"
|
|||||||
##########################################################
|
##########################################################
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
|
||||||
# ===== KRAYIN CRM =====
|
# ===== KRAYIN CRM =====
|
||||||
krayin:
|
crm:
|
||||||
image: growup:latest # Sua imagem customizada
|
image: ghcr.io/blyzer/growup-crm:latest
|
||||||
|
deploy:
|
||||||
|
update_config:
|
||||||
|
order: start-first
|
||||||
|
failure_action: rollback
|
||||||
|
delay: 10s
|
||||||
ports:
|
ports:
|
||||||
- "8090:80" # Ajuste a porta externa conforme necessário
|
- "8090:80" # Ajuste a porta externa conforme necessário
|
||||||
volumes:
|
volumes:
|
||||||
@@ -73,7 +78,7 @@ services:
|
|||||||
# ===== REDIS =====
|
# ===== REDIS =====
|
||||||
redis:
|
redis:
|
||||||
image: redis:latest
|
image: redis:latest
|
||||||
command:
|
command:
|
||||||
[
|
[
|
||||||
"redis-server",
|
"redis-server",
|
||||||
"--appendonly",
|
"--appendonly",
|
||||||
|
|||||||
44
resources/views/super-admin/layouts/master.blade.php
Normal file
44
resources/views/super-admin/layouts/master.blade.php
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html class="{{ request()->cookie('dark_mode') ? 'dark' : '' }}" lang="{{ app()->getLocale() }}" dir="{{ in_array(app()->getLocale(), ['fa', 'ar']) ? 'rtl' : 'ltr' }}">
|
||||||
|
<head>
|
||||||
|
<title>Super Admin</title>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<meta name="base-url" content="{{ url()->to('/') }}">
|
||||||
|
|
||||||
|
{{ vite()->set(['src/Resources/assets/css/app.css', 'src/Resources/assets/js/app.js']) }}
|
||||||
|
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap" rel="stylesheet" />
|
||||||
|
<link type="image/x-icon" href="{{ vite()->asset('images/favicon.ico') }}" rel="shortcut icon" sizes="16x16" />
|
||||||
|
|
||||||
|
<style>
|
||||||
|
:root { --brand-color: #0E90D9; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body class="h-full font-inter dark:bg-gray-950">
|
||||||
|
<div id="app" class="h-full">
|
||||||
|
<x-admin::flash-group />
|
||||||
|
<x-admin::modal.confirm />
|
||||||
|
|
||||||
|
@include('super-admin.layouts.header')
|
||||||
|
|
||||||
|
<div class="group/container sidebar-collapsed flex h-screen">
|
||||||
|
@include('super-admin.layouts.sidebar')
|
||||||
|
|
||||||
|
<div class="flex flex-1 flex-col overflow-hidden bg-gray-100 pt-3 transition-all duration-300 dark:bg-gray-950">
|
||||||
|
<div class="flex-1 overflow-y-auto px-4 pb-6">
|
||||||
|
@yield('content')
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@stack('scripts')
|
||||||
|
<script>
|
||||||
|
window.addEventListener("load", function(event) {
|
||||||
|
app.mount("#app");
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
43
resources/views/super-admin/tenants/edit.blade.php
Normal file
43
resources/views/super-admin/tenants/edit.blade.php
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
@extends('super-admin.layouts.master')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="md:flex md:items-center md:justify-between mb-6">
|
||||||
|
<div class="flex-1 min-w-0">
|
||||||
|
<h2 class="text-2xl font-bold leading-7 text-gray-900 dark:text-white sm:text-3xl sm:truncate">
|
||||||
|
Editar Empresa
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-5 md:mt-0 md:col-span-2">
|
||||||
|
<form action="{{ route('super-admin.tenants.update', $tenant->id) }}" method="POST">
|
||||||
|
@csrf
|
||||||
|
@method('PUT')
|
||||||
|
<div class="shadow overflow-hidden sm:rounded-md">
|
||||||
|
<div class="px-4 py-5 bg-white dark:bg-gray-900 sm:p-6">
|
||||||
|
<div class="grid grid-cols-6 gap-6">
|
||||||
|
<div class="col-span-6 sm:col-span-4">
|
||||||
|
<label for="id" class="block text-sm font-medium text-gray-700 dark:text-gray-300">ID da Empresa</label>
|
||||||
|
<input type="text" name="id" id="id" value="{{ $tenant->id }}" readonly class="mt-1 block w-full shadow-sm sm:text-sm border-gray-300 dark:border-gray-700 rounded-md p-2 border bg-gray-100 dark:bg-gray-800 dark:text-gray-400 cursor-not-allowed">
|
||||||
|
<p class="mt-2 text-sm text-gray-500 dark:text-gray-400">O ID da empresa não pode ser alterado.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-span-6 sm:col-span-4">
|
||||||
|
<label for="domain" class="block text-sm font-medium text-gray-700 dark:text-gray-300">Domínio</label>
|
||||||
|
<input type="text" name="domain" id="domain" value="{{ $tenant->domains->first()->domain ?? '' }}" autocomplete="off" class="mt-1 focus:ring-blue-500 focus:border-blue-500 block w-full shadow-sm sm:text-sm border-gray-300 dark:border-gray-700 dark:bg-gray-800 dark:text-white rounded-md p-2 border" placeholder="ex: empresa1.growuppro.com.br">
|
||||||
|
<p class="mt-2 text-sm text-gray-500 dark:text-gray-400">Domínio completo da empresa.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center justify-end gap-x-2 px-4 py-3 bg-gray-50 dark:bg-gray-800 sm:px-6">
|
||||||
|
<a href="{{ route('super-admin.tenants.index') }}" class="inline-flex justify-center py-2 px-4 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
|
||||||
|
Cancelar
|
||||||
|
</a>
|
||||||
|
<button type="submit" class="primary-button">
|
||||||
|
Atualizar
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
@@ -31,6 +31,8 @@ Route::group(['prefix' => 'super-admin', 'as' => 'super-admin.', 'middleware' =>
|
|||||||
Route::get('tenants', [TenantController::class, 'index'])->name('tenants.index');
|
Route::get('tenants', [TenantController::class, 'index'])->name('tenants.index');
|
||||||
Route::get('tenants/create', [TenantController::class, 'create'])->name('tenants.create');
|
Route::get('tenants/create', [TenantController::class, 'create'])->name('tenants.create');
|
||||||
Route::post('tenants', [TenantController::class, 'store'])->name('tenants.store');
|
Route::post('tenants', [TenantController::class, 'store'])->name('tenants.store');
|
||||||
|
Route::get('tenants/{id}/edit', [TenantController::class, 'edit'])->name('tenants.edit');
|
||||||
|
Route::put('tenants/{id}', [TenantController::class, 'update'])->name('tenants.update');
|
||||||
Route::delete('tenants/{id}', [TenantController::class, 'destroy'])->name('tenants.destroy');
|
Route::delete('tenants/{id}', [TenantController::class, 'destroy'])->name('tenants.destroy');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
0
storage/test_write
Normal file
0
storage/test_write
Normal file
Reference in New Issue
Block a user