mirror of
https://github.com/10h30/MoveMate.git
synced 2026-06-05 15:07:35 +09:00
Fix bug: Mark Completed should be shown to loggged in user only
This commit is contained in:
@@ -12,7 +12,7 @@ class TaskController extends Controller
|
||||
public function index() {
|
||||
$totalTasks = Task::count(); // Count all tasks
|
||||
$completedTasks = Task::where('completed', true)->count(); // Coun
|
||||
$tasks = Task::latest('updated_at')->Paginate(20);
|
||||
$tasks = Task::latest()->Paginate(20);
|
||||
return view('task.index', compact('tasks','totalTasks','completedTasks'));
|
||||
}
|
||||
|
||||
|
||||
@@ -12,13 +12,15 @@
|
||||
<div><strong>Time Estimate:</strong> {{ $task->time_estimate }} hour</div>
|
||||
<div><strong>Category:</strong> {{ $task->category->name }}</div>
|
||||
<div><strong>Owner:</strong> {{ $task->user->name }}</div>
|
||||
<div class="mt-4 mb-4">
|
||||
<form action="/task/{{ $task->id }}/toggle" method="POST" class="d-inline" >
|
||||
@csrf
|
||||
@method('PATCH')
|
||||
<x-form-button>{{ (! $task->completed) ? 'Mark Completed' : "Greate! You nailed it!" }}</x-form-button>
|
||||
</form>
|
||||
</div>
|
||||
@auth
|
||||
<div class="mt-4 mb-4">
|
||||
<form action="/task/{{ $task->id }}/toggle" method="POST" class="d-inline" >
|
||||
@csrf
|
||||
@method('PATCH')
|
||||
<x-form-button>{{ (! $task->completed) ? 'Mark Completed' : "Greate! You nailed it!" }}</x-form-button>
|
||||
</form>
|
||||
</div>
|
||||
@endauth
|
||||
</div>
|
||||
<div class="mt-5">
|
||||
<a href="/task/{{ $task->id }}/edit" class="text-sm text-blue-600 dark:text-blue-500 hover:underline">Edit</a>
|
||||
|
||||
Reference in New Issue
Block a user