diff --git a/timeliner/app/Http/Controllers/TimelineController.php b/timeliner/app/Http/Controllers/TimelineController.php index 99d71ae..c35219a 100644 --- a/timeliner/app/Http/Controllers/TimelineController.php +++ b/timeliner/app/Http/Controllers/TimelineController.php @@ -51,7 +51,7 @@ public function show($id) } return redirect()->route('timeline.index') - ->with('success',"You don't have access."); + ->withErrors(["You don't have access."]); } public function create() diff --git a/timeliner/app/View/Components/Notification.php b/timeliner/app/View/Components/Notification.php new file mode 100644 index 0000000..a2dbf78 --- /dev/null +++ b/timeliner/app/View/Components/Notification.php @@ -0,0 +1,26 @@ + { diff --git a/timeliner/resources/views/components/notification.blade.php b/timeliner/resources/views/components/notification.blade.php new file mode 100644 index 0000000..2c31efb --- /dev/null +++ b/timeliner/resources/views/components/notification.blade.php @@ -0,0 +1,16 @@ + +@if (session('success')) +
+ {{ session('success') }} +
+@elseif (session('info')) +
+ {{ session('info') }} +
+@elseif($errors->any()) +
+ @foreach ($errors->all() as $error) +
{{ $error }}
+ @endforeach +
+@endif \ No newline at end of file diff --git a/timeliner/resources/views/index.blade.php b/timeliner/resources/views/index.blade.php index 591c70d..03260d4 100644 --- a/timeliner/resources/views/index.blade.php +++ b/timeliner/resources/views/index.blade.php @@ -5,19 +5,7 @@ - @if (session('success')) -
- {{ session('success') }} -
- @elseif($errors->any()) -
- -
- @endif +
diff --git a/timeliner/resources/views/layouts/app.blade.php b/timeliner/resources/views/layouts/app.blade.php index d0f4954..e403196 100644 --- a/timeliner/resources/views/layouts/app.blade.php +++ b/timeliner/resources/views/layouts/app.blade.php @@ -31,7 +31,7 @@
@endisset - +
{{ $slot }}
diff --git a/timeliner/resources/views/timeline/timeline.blade.php b/timeliner/resources/views/timeline/timeline.blade.php index 4d6ec1b..9034b62 100644 --- a/timeliner/resources/views/timeline/timeline.blade.php +++ b/timeliner/resources/views/timeline/timeline.blade.php @@ -5,19 +5,7 @@ - @if (session('success')) -
- {{ session('success') }} -
- @elseif($errors->any()) -
-
    - @foreach ($errors->all() as $error) -
  • {{ $error }}
  • - @endforeach -
-
- @endif +
diff --git a/timeliner/routes/web.php b/timeliner/routes/web.php index 3ee854d..8adfc91 100644 --- a/timeliner/routes/web.php +++ b/timeliner/routes/web.php @@ -28,4 +28,7 @@ require __DIR__.'/auth.php'; Route::resource('timeline', TimelineController::class); -Route::resource('comment', CommentController::class)->only(['store', 'destroy', 'update']); + +Route::post('comment', [CommentController::class, 'store'])->name('comment.store'); +Route::delete('comment/{comment}', [CommentController::class, 'destroy'])->name('comment.destroy'); +Route::put('comment/{comment}', [CommentController::class, 'update'])->name('comment.update'); \ No newline at end of file