Skip to content

Commit

Permalink
Merge pull request #31 from envor/main
Browse files Browse the repository at this point in the history
uuid team navigation
  • Loading branch information
inmanturbo authored Jun 24, 2024
2 parents 6278f2e + 38a1bf2 commit 913ce24
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 1 deletion.
31 changes: 31 additions & 0 deletions stubs/navigation/app/Http/Controllers/TeamController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Gate;
use Laravel\Jetstream\Jetstream;

class TeamController extends Controller
{
/**
* Show the team management screen.
*
* @param int $teamId
* @return \Illuminate\View\View
*/
public function show(Request $request, $teamUUID)
{
$team = Jetstream::newTeamModel()->where('uuid', $teamUUID)->firstOrFail();

if (Gate::denies('view', $team)) {
abort(403);
}

return view('teams.show', [
'user' => $request->user(),
'team' => $team,
]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
</div>

<!-- Team Settings -->
<x-dropdown-link href="{{ route('teams.show', Auth::user()->currentTeam->id) }}" wire:navigate="true">
<x-dropdown-link href="{{ route('teams.show', Auth::user()->currentTeam->uuid) }}" wire:navigate="true">
{{ __('Team Settings') }}
</x-dropdown-link>

Expand Down
27 changes: 27 additions & 0 deletions stubs/navigation/routes/web.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

use App\Http\Controllers\TeamController;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Storage;

Route::get('/', function () {
$team = isset(app()['team']) ? app()['team'] : null;

if ($team?->landingPage) {
return response()->file(Storage::disk($team->landingPageDisk())->path($team->landingPagePath()));
}

return view('welcome');
});

Route::middleware([
'auth:sanctum',
config('jetstream.auth_session'),
'verified',
])->group(function () {
Route::get('/dashboard', function () {
return view('dashboard');
})->name('dashboard');

Route::get('/teams/{teamUUID}', [TeamController::class, 'show'])->name('teams.show');
});

0 comments on commit 913ce24

Please sign in to comment.