employees endpoint

This commit is contained in:
StudioTem committed 2023-01-17 12:21:26 +01:00
1 parent 876a67604d
commit 8b64d31962
4 files changed
+15 -2

No files matched your search

+1
View File
@@ -16,6 +16,7 @@ class UserCollection extends ResourceCollection
{
return [
'data' => $this->collection,
'status' => 200
];
}
}
+1
View File
@@ -18,6 +18,7 @@ class UserResource extends JsonResource
'id' => $this->id,
'name' => $this->firstname,
'surname' => $this->lastname,
'email' => $this->email,
'code' => $this->code,
'work_start' => $this->work_start,
'work_end' => $this->work_end,
+11
View File
@@ -1,7 +1,10 @@
<?php
use App\Http\Resources\TeamCollection;
use App\Http\Resources\TeamResource;
use App\Http\Resources\UserCollection;
use App\Models\Team;
use App\Models\User;
use Illuminate\Support\Facades\Route;
/*
@@ -22,3 +25,11 @@ use Illuminate\Support\Facades\Route;
Route::get('/v1/teams', function () {
return new TeamCollection(Team::all());
});
Route::get('/v1/teams/{id}', function ($id) {
return new TeamResource(Team::find($id));
});
Route::get('/v1/employees', function () {
return new UserCollection(User::all());
});