first work on front events
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user