- Complete GGZ Ecademy Laravel backend application - RESTful API for learning products, members, filters - Authentication and authorization system - Database migrations and seeders - Custom CRUD generator commands - Email notification system - Integration with frontend applications
This commit is contained in:
28
app/Http/Resources/PageResource.php
Normal file
28
app/Http/Resources/PageResource.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class PageResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'title' => $this->title,
|
||||
'subtitle' => $this->subtitle,
|
||||
'published_at' => $this->updated_at->toDateTimeString(),
|
||||
'created_at' => $this->updated_at->toDateTimeString(),
|
||||
'updated_at' => $this->created_at->toDateTimeString(),
|
||||
'slug' => $this->slug,
|
||||
'components' => $this->whenLoaded('components'),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user