ifx merge for update
This commit is contained in:
41
app/Http/Resources/Event.php
Normal file
41
app/Http/Resources/Event.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class Event extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'data' => [
|
||||
'type' => 'events',
|
||||
'event_id' => $this->id,
|
||||
'attributes' => [
|
||||
'data' => [
|
||||
'name' => $this->name,
|
||||
'description' => $this->description,
|
||||
'start_date' => $this->start_date,
|
||||
'end_date' => $this->end_date,
|
||||
'location' => $this->location,
|
||||
'category' => [
|
||||
'data' => [
|
||||
'category_id' => $this->category_id
|
||||
],
|
||||
],
|
||||
]
|
||||
],
|
||||
],
|
||||
'links' => [
|
||||
'self' => url('/events/'.$this->id),
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
33
app/Http/Resources/EventCategory.php
Normal file
33
app/Http/Resources/EventCategory.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class EventCategory extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'data' => [
|
||||
'type' => 'event categories',
|
||||
'event_category_id' => $this->id,
|
||||
'attributes' => [
|
||||
'data' => [
|
||||
'name' => $this->name,
|
||||
'description' => $this->description,
|
||||
]
|
||||
],
|
||||
],
|
||||
'links' => [
|
||||
'self' => url('/events/categories/'.$this->id),
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@ class Memo extends JsonResource
|
||||
'attributes' => [
|
||||
'posted_by' => new UserResource($this->user),
|
||||
'cover_image' => new ImageResource($this->coverImage),
|
||||
'thumbnail_cover_image' => new ImageResource($this->thumbnailImage),
|
||||
]
|
||||
//'tags' => TagResource::collection($this->tags),
|
||||
],
|
||||
|
||||
@@ -24,6 +24,7 @@ class User extends JsonResource
|
||||
'email' => $this->email,
|
||||
'profile_image' => new ImageResource($this->profileImage),
|
||||
'cover_image' => new ImageResource($this->coverImage),
|
||||
'thumbnail_cover_image' => new ImageResource($this->thumbnailImage),
|
||||
'last_login' => optional($this->login_at)->diffForHumans(),
|
||||
'is_admin' => $this->isAdmin(),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user