From 833e45155d7e9db41292b65930d4604f0ca7a8c0 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 11 Aug 2023 17:31:53 +0200 Subject: [PATCH] switch to auth()->user from session --- .../Controllers/ApplicationController.php | 6 ++-- app/Http/Controllers/DatabaseController.php | 6 ++-- app/Http/Controllers/MagicController.php | 2 +- app/Http/Controllers/ProjectController.php | 8 +++--- .../Destination/New/StandaloneDocker.php | 2 +- app/Http/Livewire/PrivateKey/Change.php | 2 +- app/Http/Livewire/PrivateKey/Create.php | 2 +- .../Livewire/Project/Application/Source.php | 2 +- .../Livewire/Project/New/EmptyProject.php | 2 +- .../New/GithubPrivateRepositoryDeployKey.php | 2 +- app/Http/Livewire/Server/Form.php | 2 +- app/Http/Livewire/Server/New/ByIp.php | 2 +- app/Http/Livewire/Source/Github/Create.php | 2 +- app/Http/Livewire/Team/Delete.php | 2 +- app/Http/Livewire/Team/Form.php | 2 +- app/Http/Livewire/Team/InviteLink.php | 6 ++-- app/Http/Livewire/Team/Member.php | 6 ++-- app/Models/EnvironmentVariable.php | 2 +- app/Models/GithubApp.php | 4 +-- app/Models/PrivateKey.php | 2 +- app/Models/Project.php | 2 +- app/Models/S3Storage.php | 2 +- app/Models/Server.php | 2 +- app/Models/User.php | 8 +++--- bootstrap/helpers/remoteProcess.php | 4 +-- .../views/livewire/team/delete.blade.php | 16 +++++------ resources/views/team/members.blade.php | 28 ++++++++++--------- resources/views/team/notifications.blade.php | 16 +++++++---- resources/views/team/show.blade.php | 8 ++++-- resources/views/team/storages/all.blade.php | 9 +++--- resources/views/team/storages/show.blade.php | 6 ++-- routes/web.php | 2 +- 32 files changed, 90 insertions(+), 77 deletions(-) diff --git a/app/Http/Controllers/ApplicationController.php b/app/Http/Controllers/ApplicationController.php index 41ae8f3ad..9b87492e4 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 @@ public function configuration() 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 @@ public function deployment() { $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 650051f06..bb6baf5ec 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 @@ public function configuration() 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 @@ public function executions() 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 e461cc70c..515bc14d1 100644 --- a/app/Http/Controllers/MagicController.php +++ b/app/Http/Controllers/MagicController.php @@ -41,7 +41,7 @@ public function newProject() { $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 9cab1063d..2ad941e92 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -18,7 +18,7 @@ public function all() 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 @@ public function edit() 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 @@ public function new() $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 @@ public function new() 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 da4c453b7..fa884ec37 100644 --- a/app/Http/Livewire/Destination/New/StandaloneDocker.php +++ b/app/Http/Livewire/Destination/New/StandaloneDocker.php @@ -67,7 +67,7 @@ public function submit() '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 1274910b2..d40e70e34 100644 --- a/app/Http/Livewire/PrivateKey/Change.php +++ b/app/Http/Livewire/PrivateKey/Change.php @@ -26,7 +26,7 @@ public function delete() 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 24e99cf85..82218f4a5 100644 --- a/app/Http/Livewire/PrivateKey/Create.php +++ b/app/Http/Livewire/PrivateKey/Create.php @@ -32,7 +32,7 @@ public function createPrivateKey() '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 1fec460d9..5affe9e45 100644 --- a/app/Http/Livewire/Project/Application/Source.php +++ b/app/Http/Livewire/Project/Application/Source.php @@ -29,7 +29,7 @@ public function mount() 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 931348a22..e77ab983e 100644 --- a/app/Http/Livewire/Project/New/EmptyProject.php +++ b/app/Http/Livewire/Project/New/EmptyProject.php @@ -11,7 +11,7 @@ public function createEmptyProject() { $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 1bab8ce1f..a1f275f32 100644 --- a/app/Http/Livewire/Project/New/GithubPrivateRepositoryDeployKey.php +++ b/app/Http/Livewire/Project/New/GithubPrivateRepositoryDeployKey.php @@ -55,7 +55,7 @@ public function mount() } $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 d901dd2e6..4dcebc101 100644 --- a/app/Http/Livewire/Server/Form.php +++ b/app/Http/Livewire/Server/Form.php @@ -42,7 +42,7 @@ public function mount() 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 923bae039..233ea157d 100644 --- a/app/Http/Livewire/Server/New/ByIp.php +++ b/app/Http/Livewire/Server/New/ByIp.php @@ -64,7 +64,7 @@ public function submit() '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 29ff37dfc..862964c45 100644 --- a/app/Http/Livewire/Source/Github/Create.php +++ b/app/Http/Livewire/Source/Github/Create.php @@ -40,7 +40,7 @@ public function createGitHubApp() '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 f25a8b8d8..d14e82ccc 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 56bd21db6..eedd60c83 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 d52533012..ddbe75182 100644 --- a/app/Http/Livewire/Team/InviteLink.php +++ b/app/Http/Livewire/Team/InviteLink.php @@ -35,9 +35,9 @@ private function generate_invite_link(bool $isEmail = false) 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 @@ private function generate_invite_link(bool $isEmail = false) } 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 c356de75d..237d38818 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 23a420ef5..7bbc98014 100644 --- a/app/Models/EnvironmentVariable.php +++ b/app/Models/EnvironmentVariable.php @@ -41,7 +41,7 @@ protected function value(): Attribute 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 8db24b900..c9badfed1 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 795ede3b7..4d59e9ca8 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 55bc0a6cf..a50dde167 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 69be23f0a..5cd2f1318 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 5f24de02b..91adb6b9b 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -34,7 +34,7 @@ static public function isReachable() 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 47ed5a995..b37a070c3 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -79,7 +79,7 @@ public function isAdminFromSession() 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 @@ public function currentTeam() 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 @@ public function role() 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 422b9c2ee..2fe78960b 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 da158ce58..b25b2e303 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')
Please cancel your subscription before delete this team (Manage My Subscription button).
@else - @if (session('currentTeam')->isEmpty()) + @if (auth()->user()->currentTeam()->isEmpty())
This will delete your team. Beware! There is no coming back!
Delete @@ -25,29 +25,29 @@
You need to delete the following resources to be able to delete the team:

Projects:

Servers:

Private Keys:

Sources:

- @endif - @endif + @endif + @endif - + diff --git a/resources/views/team/members.blade.php b/resources/views/team/members.blade.php index e6b5472fe..011614194 100644 --- a/resources/views/team/members.blade.php +++ b/resources/views/team/members.blade.php @@ -1,20 +1,22 @@ - +

Members

- - - - - - + + + + + + - @foreach (auth()->user()->currentTeam()->members->sortBy('name') as $member) - - @endforeach + @foreach (auth()->user()->currentTeam()->members->sortBy('name') as $member) + + @endforeach
NameEmailRoleActions
NameEmailRoleActions
@@ -26,7 +28,7 @@

Invite a new member

@if (auth()->user()->isInstanceAdmin())
You need to configure Transactional + class="underline text-warning">Transactional Emails before you can invite a @@ -37,8 +39,8 @@ class="underline text-warning">Transactional
@endif @endif - + - + @endif
diff --git a/resources/views/team/notifications.blade.php b/resources/views/team/notifications.blade.php index 529efc5f4..875102d16 100644 --- a/resources/views/team/notifications.blade.php +++ b/resources/views/team/notifications.blade.php @@ -1,19 +1,25 @@ - +

Notifications

Email + @click.prevent="activeTab = 'email'; window.location.hash = 'email'" href="#">Email Discord + @click.prevent="activeTab = 'discord'; window.location.hash = 'discord'" href="#">Discord
- +
- +
diff --git a/resources/views/team/show.blade.php b/resources/views/team/show.blade.php index e28e91295..ec5e10e1b 100644 --- a/resources/views/team/show.blade.php +++ b/resources/views/team/show.blade.php @@ -1,6 +1,8 @@ - - + + @if (is_cloud())

Subscription

@@ -27,5 +29,5 @@
@endif - +
diff --git a/resources/views/team/storages/all.blade.php b/resources/views/team/storages/all.blade.php index 07cc4a484..299ae5590 100644 --- a/resources/views/team/storages/all.blade.php +++ b/resources/views/team/storages/all.blade.php @@ -1,5 +1,7 @@ - +

S3 Storages

@@ -8,8 +10,7 @@
@forelse ($s3 as $storage) -
+
{{ $storage->name }} @@ -21,7 +22,7 @@ @empty
No storage found.
- +
@endforelse
diff --git a/resources/views/team/storages/show.blade.php b/resources/views/team/storages/show.blade.php index 18d680fd7..88f8780d6 100644 --- a/resources/views/team/storages/show.blade.php +++ b/resources/views/team/storages/show.blade.php @@ -1,4 +1,6 @@ - - + + diff --git a/routes/web.php b/routes/web.php index ad4b62251..362342dab 100644 --- a/routes/web.php +++ b/routes/web.php @@ -122,7 +122,7 @@ 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, ]);