add assigned to Tasks
Tests & Lint & Deploy to Railway / build (2.6.6, 20.x, 8.3) (push) Failing after 3m57s
Details
Tests & Lint & Deploy to Railway / build (2.6.6, 20.x, 8.3) (push) Failing after 3m57s
Details
This commit is contained in:
parent
9e618d9ba5
commit
aaa33ac58d
|
@ -27,6 +27,11 @@ class Task extends Model
|
|||
return $this->belongsTo(User::class, 'created_by_id');
|
||||
}
|
||||
|
||||
public function assigned(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(User::class);
|
||||
}
|
||||
|
||||
public function status(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(TaskStatus::class);
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('task_user', function (Blueprint $table) {
|
||||
$table->foreignId('task_id')->constrained('tasks');
|
||||
$table->foreignId('user_id')->constrained('users');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('task_user');
|
||||
}
|
||||
};
|
|
@ -18,7 +18,7 @@
|
|||
@foreach($tasks as $task)
|
||||
<tr>
|
||||
<th scope="row">{{ $task->id }}</th>
|
||||
<td>{{ $task->department->name }}</td>
|
||||
<td>{{ $task->department }}</td>
|
||||
<td>{{ $task->name }}
|
||||
<br>
|
||||
@foreach($task->labels as $label)
|
||||
|
@ -28,7 +28,7 @@
|
|||
<td>{{ $task->status->name }}</td>
|
||||
<td>{{ $task->creator->name }}</td>
|
||||
<td>
|
||||
@foreach($task->users as $user)
|
||||
@foreach($task->assigned as $user)
|
||||
{{ $user->name }}<br>
|
||||
@endforeach
|
||||
</td>
|
||||
|
|
Loading…
Reference in New Issue