Skip to content

Commit

Permalink
simplify routes to / from dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
butburg committed Sep 13, 2024
1 parent 6202f07 commit a11bdea
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .timetracker

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/resources/views/components/gallery/share.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$post,
config('app.posts_per_page'),
);
$shareUrl = route('welcome') . "?page={$page}#post-{$post->id}";
$shareUrl = route('dashboard') . "?page={$page}#post-{$post->id}";
@endphp

<!-- SVG Button for Sharing -->
Expand Down
2 changes: 1 addition & 1 deletion src/resources/views/layouts/guest.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<div
class="flex min-h-screen flex-col items-center pt-6 sm:justify-center sm:pt-0">
<div>
<a href="{{ route('welcome') }}">
<a href="{{ route('dashboard') }}">
<x-application-logo class="h-32" />
</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/resources/views/layouts/navigation.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
@else
<!-- Logo -->
<div class="flex shrink-0 items-center">
<a href="{{ route('welcome') }}">
<a href="{{ route('dashboard') }}">
<x-application-logo class="h-14" />
</a>
</div>
Expand Down
8 changes: 2 additions & 6 deletions src/resources/views/welcome.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@
<!-- Flex container with space between elements -->
<div class="flex items-center justify-between">
<x-header2>Weedy Gallery</x-header2>

{{-- check if there is a notif.success flash session --}}
@if (Session::has('notif.success'))
<div class="-my-3 rounded-lg bg-blue-300 px-4 py-2">
{{-- if it's there then print the notification --}}
<span class="italic text-white">{{ Session::get('notif.success') }}</span>
<span
class="italic text-white">{{ Session::get('notif.success') }}</span>
</div>
@endif

<!-- Link to add a new post -->
<x-create-post-button />

</div>
</x-slot>
<div class="bg-c-background text-c-text">
Expand All @@ -25,7 +23,5 @@
{{ $posts->links() }}
</div>
</div>

</div>

</x-app-layout>
43 changes: 21 additions & 22 deletions src/routes/web.php
Original file line number Diff line number Diff line change
@@ -1,56 +1,46 @@
<?php

use App\Http\Controllers\ProfileController;
use App\Http\Controllers\PostController;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\TestMailController;
use App\Http\Controllers\CommentController;
use App\Http\Controllers\AdminController;
use App\Http\Controllers\CommentController;
use App\Http\Controllers\PostController;
use App\Http\Controllers\ProfileController;
use App\Http\Middleware\Admin;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Route;


Route::get('/', [PostController::class, 'gallery'])->name('welcome');
Route::get('/', [PostController::class, 'gallery'])
->name('dashboard');

Route::get('/dashboard', [PostController::class, 'gallery'])->middleware(['auth', 'verified'])->name('dashboard');
Route::view('/impressum', 'impressum')->name('impressum');
#Route::get('/send-test-email', [TestMailController::class, 'sendTestEmail']);

Route::get('/send-test-email', function () {
Mail::raw('This is a test email', function ($message) {
$message->to('recipient@example.com')->subject('Test Email');
});
return 'Test email sent!';
});

Route::middleware('auth', 'verified')->group(function () {
// Routes here are accessible to authenticated users only!!

Route::get('/admin', [AdminController::class, 'dashboard'])->name('admin.index')->middleware(Admin::class);
Route::get('/admin/posts', [PostController::class, 'all'])->name('posts.index')->middleware(Admin::class);
// Admin
Route::middleware(Admin::class)->group(function () {
Route::get('/admin', [AdminController::class, 'dashboard'])->name('admin.index');
Route::get('/admin/posts', [PostController::class, 'all'])->name('posts.index');
});

// Profiles
Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit');
Route::get('/profile/{user}', [ProfileController::class, 'show'])->name('profile.show');

Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit');

Route::patch('/profile/update-name', [ProfileController::class, 'updateName'])
->name('profile.updateName');

Route::patch('/profile/update-description', [ProfileController::class, 'updateDescription'])
->name('profile.updateDescription');

Route::patch('/profile/update-email', [ProfileController::class, 'updateEmail'])
->name('profile.updateEmail');

Route::patch('/profile/update-image', [ProfileController::class, 'updateImage'])
->name('profile.updateImage');

Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
Route::put('/profile/update-image', [ProfileController::class, 'updateImage'])->name('profile.updateImage');



// Posts
Route::get('/posts/{post}/publish', [PostController::class, 'publish'])->name('posts.publish');
Route::get('/posts/{post}/make-draft', [PostController::class, 'makedraft'])->name('posts.make-draft');
Expand All @@ -62,6 +52,15 @@
'posts' => PostController::class,
'comments' => CommentController::class,
]);

// Mail
#Route::get('/send-test-email', [TestMailController::class, 'sendTestEmail']);
Route::get('/send-test-email', function () {
Mail::raw('This is a test email', function ($message) {
$message->to('recipient@example.com')->subject('Test Email');
});
return 'Test email sent!';
});
});

require __DIR__ . '/auth.php';

0 comments on commit a11bdea

Please sign in to comment.