first work on front events

This commit is contained in:
2020-08-24 07:55:32 +02:00
parent 0f4250a029
commit f466ce7cc9
17 changed files with 575 additions and 32 deletions

View File

@@ -14,11 +14,15 @@ class EventController extends Controller
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\Response|object
*/
public function index()
{
//
$events = Event::all();
return (EventResource::collection($events))
->response()
->setStatusCode(200);
}
/**

View File

@@ -3,6 +3,7 @@
namespace App\Http\Resources;
use App\Http\Resources\User as UserResource;
use App\Http\Resources\EventCategory as EventCategoryRessource;
use App\Http\Resources\EventGuestWithoutEmail as GuestsWithoutEmailResource;
use Illuminate\Http\Resources\Json\JsonResource;
@@ -27,11 +28,7 @@ class Event extends JsonResource
'start_date' => $this->start_date,
'end_date' => $this->end_date,
'location' => $this->location,
'category' => [
'data' => [
'category_id' => $this->category_id
],
],
'category' => new EventCategoryRessource($this->category),
'invitations' => UserResource::collection($this->guests),
'invitations-with-email' => [
'data' => GuestsWithoutEmailResource::collection($this->emailedGuests)