Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

switch to auth()->user from session

Andras Bacsai833e45155d7e
diff --git a/app/Http/Controllers/ApplicationController.php b/app/Http/Controllers/ApplicationController.php
index 41ae8f3ad1..9b87492e4c 100644
--- a/app/Http/Controllers/ApplicationController.php
+++ b/app/Http/Controllers/ApplicationController.php
@@ -12,7 +12,7 @@ class ApplicationController extends Controller
public function configuration()
{
- $project = session('currentTeam')->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
+ $project = auth()->user()->currentTeam()->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
if (!$project) {
return redirect()->route('dashboard');
}
@@ -29,7 +29,7 @@ class ApplicationController extends Controller
public function deployments()
{
- $project = session('currentTeam')->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
+ $project = auth()->user()->currentTeam()->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
if (!$project) {
return redirect()->route('dashboard');
}
@@ -49,7 +49,7 @@ class ApplicationController extends Controller
{
$deploymentUuid = request()->route('deployment_uuid');
- $project = session('currentTeam')->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
+ $project = auth()->user()->currentTeam()->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
if (!$project) {
return redirect()->route('dashboard');
}
diff --git a/app/Http/Controllers/DatabaseController.php b/app/Http/Controllers/DatabaseController.php
index 650051f060..bb6baf5ecb 100644
--- a/app/Http/Controllers/DatabaseController.php
+++ b/app/Http/Controllers/DatabaseController.php
@@ -11,7 +11,7 @@ class DatabaseController extends Controller
public function configuration()
{
- $project = session('currentTeam')->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
+ $project = auth()->user()->currentTeam()->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
if (!$project) {
return redirect()->route('dashboard');
}
@@ -29,7 +29,7 @@ class DatabaseController extends Controller
public function executions()
{
$backup_uuid = request()->route('backup_uuid');
- $project = session('currentTeam')->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
+ $project = auth()->user()->currentTeam()->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
if (!$project) {
return redirect()->route('dashboard');
}
@@ -56,7 +56,7 @@ class DatabaseController extends Controller
public function backups()
{
- $project = session('currentTeam')->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
+ $project = auth()->user()->currentTeam()->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
if (!$project) {
return redirect()->route('dashboard');
}
diff --git a/app/Http/Controllers/MagicController.php b/app/Http/Controllers/MagicController.php
index e461cc70c1..515bc14d1f 100644
--- a/app/Http/Controllers/MagicController.php
+++ b/app/Http/Controllers/MagicController.php
@@ -41,7 +41,7 @@ class MagicController extends Controller
{
$project = Project::firstOrCreate(
['name' => request()->query('name') ?? generate_random_name()],
- ['team_id' => session('currentTeam')->id]
+ ['team_id' => auth()->user()->currentTeam()->id]
);
return response()->json([
'project_uuid' => $project->uuid
diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php
index 9cab1063db..2ad941e922 100644
--- a/app/Http/Controllers/ProjectController.php
+++ b/app/Http/Controllers/ProjectController.php
@@ -18,7 +18,7 @@ class ProjectController extends Controller
public function edit()
{
$projectUuid = request()->route('project_uuid');
- $teamId = session('currentTeam')->id;
+ $teamId = auth()->user()->currentTeam()->id;
$project = Project::where('team_id', $teamId)->where('uuid', $projectUuid)->first();
if (!$project) {
return redirect()->route('dashboard');
@@ -29,7 +29,7 @@ class ProjectController extends Controller
public function show()
{
$projectUuid = request()->route('project_uuid');
- $teamId = session('currentTeam')->id;
+ $teamId = auth()->user()->currentTeam()->id;
$project = Project::where('team_id', $teamId)->where('uuid', $projectUuid)->first();
if (!$project) {
@@ -44,7 +44,7 @@ class ProjectController extends Controller
$type = request()->query('type');
$destination_uuid = request()->query('destination');
- $project = session('currentTeam')->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
+ $project = auth()->user()->currentTeam()->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
if (!$project) {
return redirect()->route('dashboard');
}
@@ -67,7 +67,7 @@ class ProjectController extends Controller
public function resources()
{
- $project = session('currentTeam')->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
+ $project = auth()->user()->currentTeam()->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
if (!$project) {
return redirect()->route('dashboard');
}
diff --git a/app/Http/Livewire/Destination/New/StandaloneDocker.php b/app/Http/Livewire/Destination/New/StandaloneDocker.php
index da4c453b76..fa884ec373 100644
--- a/app/Http/Livewire/Destination/New/StandaloneDocker.php
+++ b/app/Http/Livewire/Destination/New/StandaloneDocker.php
@@ -67,7 +67,7 @@ class StandaloneDocker extends Component
'name' => $this->name,
'network' => $this->network,
'server_id' => $this->server_id,
- 'team_id' => session('currentTeam')->id
+ 'team_id' => auth()->user()->currentTeam()->id
]);
}
$this->createNetworkAndAttachToProxy();
diff --git a/app/Http/Livewire/PrivateKey/Change.php b/app/Http/Livewire/PrivateKey/Change.php
index 1274910b2a..d40e70e34a 100644
--- a/app/Http/Livewire/PrivateKey/Change.php
+++ b/app/Http/Livewire/PrivateKey/Change.php
@@ -26,7 +26,7 @@ class Change extends Component
try {
if ($this->private_key->isEmpty()) {
$this->private_key->delete();
- session('currentTeam')->privateKeys = PrivateKey::where('team_id', session('currentTeam')->id)->get();
+ auth()->user()->currentTeam()->privateKeys = PrivateKey::where('team_id', auth()->user()->currentTeam()->id)->get();
return redirect()->route('private-key.all');
}
$this->emit('error', 'This private key is in use and cannot be deleted. Please delete all servers, applications, and GitHub/GitLab apps that use this private key before deleting it.');
diff --git a/app/Http/Livewire/PrivateKey/Create.php b/app/Http/Livewire/PrivateKey/Create.php
index 24e99cf85a..82218f4a56 100644
--- a/app/Http/Livewire/PrivateKey/Create.php
+++ b/app/Http/Livewire/PrivateKey/Create.php
@@ -32,7 +32,7 @@ class Create extends Component
'name' => $this->name,
'description' => $this->description,
'private_key' => $this->value,
- 'team_id' => session('currentTeam')->id
+ 'team_id' => auth()->user()->currentTeam()->id
]);
if ($this->from === 'server') {
return redirect()->route('server.create');
diff --git a/app/Http/Livewire/Project/Application/Source.php b/app/Http/Livewire/Project/Application/Source.php
index 1fec460d9b..5affe9e45b 100644
--- a/app/Http/Livewire/Project/Application/Source.php
+++ b/app/Http/Livewire/Project/Application/Source.php
@@ -29,7 +29,7 @@ class Source extends Component
private function get_private_keys()
{
- $this->private_keys = PrivateKey::whereTeamId(session('currentTeam')->id)->get()->reject(function ($key) {
+ $this->private_keys = PrivateKey::whereTeamId(auth()->user()->currentTeam()->id)->get()->reject(function ($key) {
return $key->id == $this->application->private_key_id;
});
}
diff --git a/app/Http/Livewire/Project/New/EmptyProject.php b/app/Http/Livewire/Project/New/EmptyProject.php
index 931348a22b..e77ab983e2 100644
--- a/app/Http/Livewire/Project/New/EmptyProject.php
+++ b/app/Http/Livewire/Project/New/EmptyProject.php
@@ -11,7 +11,7 @@ class EmptyProject extends Component
{
$project = Project::create([
'name' => generate_random_name(),
- 'team_id' => session('currentTeam')->id,
+ 'team_id' => auth()->user()->currentTeam()->id,
]);
return redirect()->route('project.show', ['project_uuid' => $project->uuid, 'environment_name' => 'production']);
}
diff --git a/app/Http/Livewire/Project/New/GithubPrivateRepositoryDeployKey.php b/app/Http/Livewire/Project/New/GithubPrivateRepositoryDeployKey.php
index 1bab8ce1ff..a1f275f329 100644
--- a/app/Http/Livewire/Project/New/GithubPrivateRepositoryDeployKey.php
+++ b/app/Http/Livewire/Project/New/GithubPrivateRepositoryDeployKey.php
@@ -55,7 +55,7 @@ class GithubPrivateRepositoryDeployKey extends Component
}
$this->parameters = get_route_parameters();
$this->query = request()->query();
- $this->private_keys = PrivateKey::where('team_id', session('currentTeam')->id)->where('id', '!=', 0)->get();
+ $this->private_keys = PrivateKey::where('team_id', auth()->user()->currentTeam()->id)->where('id', '!=', 0)->get();
}
public function instantSave()
diff --git a/app/Http/Livewire/Server/Form.php b/app/Http/Livewire/Server/Form.php
index d901dd2e6a..4dcebc101b 100644
--- a/app/Http/Livewire/Server/Form.php
+++ b/app/Http/Livewire/Server/Form.php
@@ -42,7 +42,7 @@ class Form extends Component
public function installDocker()
{
- $activity = resolve(InstallDocker::class)($this->server, session('currentTeam'));
+ $activity = resolve(InstallDocker::class)($this->server, auth()->user()->currentTeam());
$this->emit('newMonitorActivity', $activity->id);
}
diff --git a/app/Http/Livewire/Server/New/ByIp.php b/app/Http/Livewire/Server/New/ByIp.php
index 923bae0390..233ea157d5 100644
--- a/app/Http/Livewire/Server/New/ByIp.php
+++ b/app/Http/Livewire/Server/New/ByIp.php
@@ -64,7 +64,7 @@ class ByIp extends Component
'ip' => $this->ip,
'user' => $this->user,
'port' => $this->port,
- 'team_id' => session('currentTeam')->id,
+ 'team_id' => auth()->user()->currentTeam()->id,
'private_key_id' => $this->private_key_id,
]);
$server->settings->is_part_of_swarm = $this->is_part_of_swarm;
diff --git a/app/Http/Livewire/Source/Github/Create.php b/app/Http/Livewire/Source/Github/Create.php
index 29ff37dfcd..862964c45c 100644
--- a/app/Http/Livewire/Source/Github/Create.php
+++ b/app/Http/Livewire/Source/Github/Create.php
@@ -40,7 +40,7 @@ class Create extends Component
'custom_user' => $this->custom_user,
'custom_port' => $this->custom_port,
'is_system_wide' => $this->is_system_wide,
- 'team_id' => session('currentTeam')->id,
+ 'team_id' => auth()->user()->currentTeam()->id,
]);
redirect()->route('source.github.show', ['github_app_uuid' => $github_app->uuid]);
} catch (\Exception $e) {
diff --git a/app/Http/Livewire/Team/Delete.php b/app/Http/Livewire/Team/Delete.php
index f25a8b8d8c..d14e82ccc6 100644
--- a/app/Http/Livewire/Team/Delete.php
+++ b/app/Http/Livewire/Team/Delete.php
@@ -9,7 +9,7 @@ class Delete extends Component
{
public function delete()
{
- $currentTeam = session('currentTeam');
+ $currentTeam = auth()->user()->currentTeam();
$currentTeam->delete();
$team = auth()->user()->teams()->first();
diff --git a/app/Http/Livewire/Team/Form.php b/app/Http/Livewire/Team/Form.php
index 56bd21db60..eedd60c830 100644
--- a/app/Http/Livewire/Team/Form.php
+++ b/app/Http/Livewire/Team/Form.php
@@ -19,7 +19,7 @@ class Form extends Component
public function mount()
{
- $this->team = session('currentTeam');
+ $this->team = auth()->user()->currentTeam();
}
public function submit()
diff --git a/app/Http/Livewire/Team/InviteLink.php b/app/Http/Livewire/Team/InviteLink.php
index d525330124..ddbe75182b 100644
--- a/app/Http/Livewire/Team/InviteLink.php
+++ b/app/Http/Livewire/Team/InviteLink.php
@@ -35,9 +35,9 @@ class InviteLink extends Component
return general_error_handler(that: $this, customErrorMessage: "$this->email must be registered first (or activate transactional emails to invite via email).");
}
- $member_emails = session('currentTeam')->members()->get()->pluck('email');
+ $member_emails = auth()->user()->currentTeam()->members()->get()->pluck('email');
if ($member_emails->contains($this->email)) {
- return general_error_handler(that: $this, customErrorMessage: "$this->email is already a member of " . session('currentTeam')->name . ".");
+ return general_error_handler(that: $this, customErrorMessage: "$this->email is already a member of " . auth()->user()->currentTeam()->name . ".");
}
$invitation = TeamInvitation::whereEmail($this->email);
@@ -53,7 +53,7 @@ class InviteLink extends Component
}
TeamInvitation::firstOrCreate([
- 'team_id' => session('currentTeam')->id,
+ 'team_id' => auth()->user()->currentTeam()->id,
'uuid' => $uuid,
'email' => $this->email,
'role' => $this->role,
diff --git a/app/Http/Livewire/Team/Member.php b/app/Http/Livewire/Team/Member.php
index c356de75d8..237d388185 100644
--- a/app/Http/Livewire/Team/Member.php
+++ b/app/Http/Livewire/Team/Member.php
@@ -11,19 +11,19 @@ class Member extends Component
public function makeAdmin()
{
- $this->member->teams()->updateExistingPivot(session('currentTeam')->id, ['role' => 'admin']);
+ $this->member->teams()->updateExistingPivot(auth()->user()->currentTeam()->id, ['role' => 'admin']);
$this->emit('reloadWindow');
}
public function makeReadonly()
{
- $this->member->teams()->updateExistingPivot(session('currentTeam')->id, ['role' => 'member']);
+ $this->member->teams()->updateExistingPivot(auth()->user()->currentTeam()->id, ['role' => 'member']);
$this->emit('reloadWindow');
}
public function remove()
{
- $this->member->teams()->detach(session('currentTeam'));
+ $this->member->teams()->detach(auth()->user()->currentTeam());
$this->emit('reloadWindow');
}
}
diff --git a/app/Models/EnvironmentVariable.php b/app/Models/EnvironmentVariable.php
index 23a420ef59..7bbc98014e 100644
--- a/app/Models/EnvironmentVariable.php
+++ b/app/Models/EnvironmentVariable.php
@@ -41,7 +41,7 @@ class EnvironmentVariable extends Model
private function get_environment_variables(string $environment_variable): string|null
{
- // $team_id = session('currentTeam')->id;
+ // $team_id = auth()->user()->currentTeam()->id;
if (str_contains(trim($environment_variable), '{{') && str_contains(trim($environment_variable), '}}')) {
$environment_variable = preg_replace('/\s+/', '', $environment_variable);
$environment_variable = str_replace('{{', '', $environment_variable);
diff --git a/app/Models/GithubApp.php b/app/Models/GithubApp.php
index 8db24b9006..c9badfed12 100644
--- a/app/Models/GithubApp.php
+++ b/app/Models/GithubApp.php
@@ -19,12 +19,12 @@ class GithubApp extends BaseModel
static public function public()
{
- return GithubApp::whereTeamId(session('currentTeam')->id)->whereisPublic(true)->whereNotNull('app_id')->get();
+ return GithubApp::whereTeamId(auth()->user()->currentTeam()->id)->whereisPublic(true)->whereNotNull('app_id')->get();
}
static public function private()
{
- return GithubApp::whereTeamId(session('currentTeam')->id)->whereisPublic(false)->whereNotNull('app_id')->get();
+ return GithubApp::whereTeamId(auth()->user()->currentTeam()->id)->whereisPublic(false)->whereNotNull('app_id')->get();
}
protected static function booted(): void
diff --git a/app/Models/PrivateKey.php b/app/Models/PrivateKey.php
index 795ede3b77..4d59e9ca8a 100644
--- a/app/Models/PrivateKey.php
+++ b/app/Models/PrivateKey.php
@@ -16,7 +16,7 @@ class PrivateKey extends BaseModel
static public function ownedByCurrentTeam(array $select = ['*'])
{
$selectArray = collect($select)->concat(['id']);
- return PrivateKey::whereTeamId(session('currentTeam')->id)->select($selectArray->all());
+ return PrivateKey::whereTeamId(auth()->user()->currentTeam()->id)->select($selectArray->all());
}
public function isEmpty()
diff --git a/app/Models/Project.php b/app/Models/Project.php
index 55bc0a6cff..a50dde167d 100644
--- a/app/Models/Project.php
+++ b/app/Models/Project.php
@@ -13,7 +13,7 @@ class Project extends BaseModel
static public function ownedByCurrentTeam()
{
- return Project::whereTeamId(session('currentTeam')->id)->orderBy('name');
+ return Project::whereTeamId(auth()->user()->currentTeam()->id)->orderBy('name');
}
protected static function booted()
diff --git a/app/Models/S3Storage.php b/app/Models/S3Storage.php
index 69be23f0ac..5cd2f13183 100644
--- a/app/Models/S3Storage.php
+++ b/app/Models/S3Storage.php
@@ -17,7 +17,7 @@ class S3Storage extends BaseModel
static public function ownedByCurrentTeam(array $select = ['*'])
{
$selectArray = collect($select)->concat(['id']);
- return S3Storage::whereTeamId(session('currentTeam')->id)->select($selectArray->all())->orderBy('name');
+ return S3Storage::whereTeamId(auth()->user()->currentTeam()->id)->select($selectArray->all())->orderBy('name');
}
public function awsUrl()
diff --git a/app/Models/Server.php b/app/Models/Server.php
index 5f24de02b3..91adb6b9bb 100644
--- a/app/Models/Server.php
+++ b/app/Models/Server.php
@@ -34,7 +34,7 @@ class Server extends BaseModel
static public function ownedByCurrentTeam(array $select = ['*'])
{
$selectArray = collect($select)->concat(['id']);
- return Server::whereTeamId(session('currentTeam')->id)->with('settings')->select($selectArray->all())->orderBy('name');
+ return Server::whereTeamId(auth()->user()->currentTeam()->id)->with('settings')->select($selectArray->all())->orderBy('name');
}
static public function isUsable()
diff --git a/app/Models/User.php b/app/Models/User.php
index 47ed5a9954..b37a070c37 100644
--- a/app/Models/User.php
+++ b/app/Models/User.php
@@ -79,7 +79,7 @@ class User extends Authenticatable implements SendsEmail
if ($is_part_of_root_team && $is_admin_of_root_team) {
return true;
}
- $role = $teams->where('id', session('currentTeam')->id)->first()->pivot->role;
+ $role = $teams->where('id', auth()->user()->id)->first()->pivot->role;
return $role === 'admin' || $role === 'owner';
}
@@ -106,7 +106,7 @@ class User extends Authenticatable implements SendsEmail
public function otherTeams()
{
- $team_id = session('currentTeam')->id;
+ $team_id = auth()->user()->currentTeam()->id;
return auth()->user()->teams->filter(function ($team) use ($team_id) {
return $team->id != $team_id;
});
@@ -117,12 +117,12 @@ class User extends Authenticatable implements SendsEmail
if ($this->teams()->where('team_id', 0)->first()) {
return 'admin';
}
- return $this->teams()->where('team_id', session('currentTeam')->id)->first()->pivot->role;
+ return $this->teams()->where('team_id', auth()->user()->currentTeam()->id)->first()->pivot->role;
}
public function resources()
{
- $team_id = session('currentTeam')->id;
+ $team_id = auth()->user()->currentTeam()->id;
$data = Application::where('team_id', $team_id)->get();
return $data;
}
diff --git a/bootstrap/helpers/remoteProcess.php b/bootstrap/helpers/remoteProcess.php
index 422b9c2eee..2fe78960bf 100644
--- a/bootstrap/helpers/remoteProcess.php
+++ b/bootstrap/helpers/remoteProcess.php
@@ -158,8 +158,8 @@ function refreshPrivateKey(PrivateKey $private_key)
foreach ($private_key->servers as $server) {
// Delete the old ssh mux file to force a new one to be created
Storage::disk('ssh-mux')->delete($server->muxFilename());
- if (session('currentTeam')->id) {
- session('currentTeam')->privateKeys = PrivateKey::where('team_id', session('currentTeam')->id)->get();
+ if (auth()->user()->currentTeam()->id) {
+ auth()->user()->currentTeam()->privateKeys = PrivateKey::where('team_id', auth()->user()->currentTeam()->id)->get();
}
}
}
diff --git a/resources/views/livewire/team/delete.blade.php b/resources/views/livewire/team/delete.blade.php
index da158ce585..b25b2e3039 100644
--- a/resources/views/livewire/team/delete.blade.php
+++ b/resources/views/livewire/team/delete.blade.php
@@ -15,7 +15,7 @@
auth()->user()->currentTeam()->subscription?->lemon_status !== 'cancelled')
<div>Please cancel your subscription before delete this team (Manage My Subscription button).</div>
@else
- @if (session('currentTeam')->isEmpty())
+ @if (auth()->user()->currentTeam()->isEmpty())
<div class="pb-4">This will delete your team. Beware! There is no coming back!</div>
<x-forms.button isError isModal modalId="deleteTeam">
Delete
@@ -25,29 +25,29 @@
<div class="pb-4">You need to delete the following resources to be able to delete the team:</div>
<h4 class="pb-4">Projects:</h4>
<ul class="pl-8 list-disc">
- @foreach (session('currentTeam')->projects as $resource)
+ @foreach (auth()->user()->currentTeam()->projects as $resource)
<li>{{ $resource->name }}</li>
@endforeach
</ul>
<h4 class="py-4">Servers:</h4>
<ul class="pl-8 list-disc">
- @foreach (session('currentTeam')->servers as $resource)
+ @foreach (auth()->user()->currentTeam()->servers as $resource)
<li>{{ $resource->name }}</li>
@endforeach
</ul>
<h4 class="py-4">Private Keys:</h4>
<ul class="pl-8 list-disc">
- @foreach (session('currentTeam')->privateKeys as $resource)
+ @foreach (auth()->user()->currentTeam()->privateKeys as $resource)
<li>{{ $resource->name }}</li>
@endforeach
</ul>
<h4 class="py-4">Sources:</h4>
<ul class="pl-8 list-disc">
- @foreach (session('currentTeam')->sources() as $resource)
+ @foreach (auth()->user()->currentTeam()->sources() as $resource)
<li>{{ $resource->name }}</li>
@endforeach
</ul>
- @endif
- @endif
+ @endif
+ @endif
- </div>
+</div>
diff --git a/resources/views/team/members.blade.php b/resources/views/team/members.blade.php
index e6b5472fe2..011614194d 100644
--- a/resources/views/team/members.blade.php
+++ b/resources/views/team/members.blade.php
@@ -1,20 +1,22 @@
<x-layout>
- <x-team.navbar :team="session('currentTeam')"/>
+ <x-team.navbar :team="auth()
+ ->user()
+ ->currentTeam()" />
<h2>Members</h2>
<div class="pt-4 overflow-hidden">
<table>
<thead>
- <tr>
- <th>Name</th>
- <th>Email</th>
- <th>Role</th>
- <th>Actions</th>
- </tr>
+ <tr>
+ <th>Name</th>
+ <th>Email</th>
+ <th>Role</th>
+ <th>Actions</th>
+ </tr>
</thead>
<tbody>
- @foreach (auth()->user()->currentTeam()->members->sortBy('name') as $member)
- <livewire:team.member :member="$member" :wire:key="$member->id"/>
- @endforeach
+ @foreach (auth()->user()->currentTeam()->members->sortBy('name') as $member)
+ <livewire:team.member :member="$member" :wire:key="$member->id" />
+ @endforeach
</tbody>
</table>
</div>
@@ -26,7 +28,7 @@
<h3>Invite a new member</h3>
@if (auth()->user()->isInstanceAdmin())
<div class="pb-4 text-xs text-warning">You need to configure <a href="/settings/emails"
- class="underline text-warning">Transactional
+ class="underline text-warning">Transactional
Emails</a>
before
you can invite a
@@ -37,8 +39,8 @@
</div>
@endif
@endif
- <livewire:team.invite-link/>
+ <livewire:team.invite-link />
</div>
- <livewire:team.invitations :invitations="$invitations"/>
+ <livewire:team.invitations :invitations="$invitations" />
@endif
</x-layout>
diff --git a/resources/views/team/notifications.blade.php b/resources/views/team/notifications.blade.php
index 529efc5f48..875102d165 100644
--- a/resources/views/team/notifications.blade.php
+++ b/resources/views/team/notifications.blade.php
@@ -1,19 +1,25 @@
<x-layout>
- <x-team.navbar :team="session('currentTeam')"/>
+ <x-team.navbar :team="auth()
+ ->user()
+ ->currentTeam()" />
<h2 class="pb-4">Notifications</h2>
<div x-data="{ activeTab: window.location.hash ? window.location.hash.substring(1) : 'email' }" class="flex h-full">
<div class="flex flex-col gap-4 min-w-fit">
<a :class="activeTab === 'email' && 'text-white'"
- @click.prevent="activeTab = 'email'; window.location.hash = 'email'" href="#">Email</a>
+ @click.prevent="activeTab = 'email'; window.location.hash = 'email'" href="#">Email</a>
<a :class="activeTab === 'discord' && 'text-white'"
- @click.prevent="activeTab = 'discord'; window.location.hash = 'discord'" href="#">Discord</a>
+ @click.prevent="activeTab = 'discord'; window.location.hash = 'discord'" href="#">Discord</a>
</div>
<div class="w-full pl-8">
<div x-cloak x-show="activeTab === 'email'" class="h-full">
- <livewire:notifications.email-settings :model="session('currentTeam')"/>
+ <livewire:notifications.email-settings :model="auth()
+ ->user()
+ ->currentTeam()" />
</div>
<div x-cloak x-show="activeTab === 'discord'">
- <livewire:notifications.discord-settings :model="session('currentTeam')"/>
+ <livewire:notifications.discord-settings :model="auth()
+ ->user()
+ ->currentTeam()" />
</div>
</div>
</x-layout>
diff --git a/resources/views/team/show.blade.php b/resources/views/team/show.blade.php
index e28e91295b..ec5e10e1b4 100644
--- a/resources/views/team/show.blade.php
+++ b/resources/views/team/show.blade.php
@@ -1,6 +1,8 @@
<x-layout>
- <x-team.navbar :team="session('currentTeam')"/>
- <livewire:team.form/>
+ <x-team.navbar :team="auth()
+ ->user()
+ ->currentTeam()" />
+ <livewire:team.form />
@if (is_cloud())
<div class="pb-8">
<h3>Subscription</h3>
@@ -27,5 +29,5 @@
</x-forms.button>
</div>
@endif
- <livewire:team.delete/>
+ <livewire:team.delete />
</x-layout>
diff --git a/resources/views/team/storages/all.blade.php b/resources/views/team/storages/all.blade.php
index 07cc4a4848..299ae5590a 100644
--- a/resources/views/team/storages/all.blade.php
+++ b/resources/views/team/storages/all.blade.php
@@ -1,5 +1,7 @@
<x-layout>
- <x-team.navbar :team="session('currentTeam')"/>
+ <x-team.navbar :team="auth()
+ ->user()
+ ->currentTeam()" />
<div class="flex items-start gap-2">
<h2 class="pb-4">S3 Storages</h2>
<x-forms.button class="btn">
@@ -8,8 +10,7 @@
</div>
<div class="grid gap-2 lg:grid-cols-2">
@forelse ($s3 as $storage)
- <div x-data
- x-on:click="goto('{{ $storage->uuid }}')" @class(['gap-2 border cursor-pointer box group border-transparent'])>
+ <div x-data x-on:click="goto('{{ $storage->uuid }}')" @class(['gap-2 border cursor-pointer box group border-transparent'])>
<div class="flex flex-col mx-6">
<div class=" group-hover:text-white">
{{ $storage->name }}
@@ -21,7 +22,7 @@
@empty
<div>
<div>No storage found.</div>
- <x-use-magic-bar link="/team/storages/new"/>
+ <x-use-magic-bar link="/team/storages/new" />
</div>
@endforelse
</div>
diff --git a/resources/views/team/storages/show.blade.php b/resources/views/team/storages/show.blade.php
index 18d680fd76..88f8780d6c 100644
--- a/resources/views/team/storages/show.blade.php
+++ b/resources/views/team/storages/show.blade.php
@@ -1,4 +1,6 @@
<x-layout>
- <x-team.navbar :team="session('currentTeam')"/>
- <livewire:team.storage.form :storage="$storage"/>
+ <x-team.navbar :team="auth()
+ ->user()
+ ->currentTeam()" />
+ <livewire:team.storage.form :storage="$storage" />
</x-layout>
diff --git a/routes/web.php b/routes/web.php
index ad4b622510..362342dabc 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -122,7 +122,7 @@ Route::middleware(['auth'])->group(function () {
Route::middleware(['auth'])->group(function () {
Route::get('/source/new', fn() => view('source.new'))->name('source.new');
Route::get('/sources', function () {
- $sources = session('currentTeam')->sources();
+ $sources = auth()->user()->currentTeam()->sources();
return view('source.all', [
'sources' => $sources,
]);