resource instead of model

This commit is contained in:
StudioTem committed 2023-02-15 09:36:33 +01:00
1 parent a2a29b529b
commit a1a410c54d
1 file changed
+4 -2
@@ -2,6 +2,8 @@
namespace App\Http\Controllers;
use App\Http\Resources\SubTaskCollection;
use App\Http\Resources\SubTaskResource;
use App\Models\Attachment;
use App\Models\MasterTask;
use App\Models\SubTask;
@@ -84,7 +86,7 @@ class SubTaskController extends Controller
$subtasks = SubTask::where('user_id', $parameters['user_id'])->where('is_finished', 0)->whereDoesntHave( 'timeblocks')->get();
return response()->json( [
'subtasks' => $subtasks
'subtasks' => SubTaskResource::collection($subtasks)
], 200 );
}
@@ -105,7 +107,7 @@ class SubTaskController extends Controller
$subtasks = SubTask::where('user_id', $parameters['user_id'])->where('is_finished', 0)->get();
return response()->json( [
'subtasks' => $subtasks
'subtasks' => SubTaskResource::collection($subtasks)
], 200 );
}