31 lines
815 B
PHP
31 lines
815 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class BeritaResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'judul' => $this->judul,
|
|
'kategori' => $this->kategori,
|
|
'ringkasan' => $this->ringkasan,
|
|
'isi' => $this->isi,
|
|
'gambar' => $this->gambar,
|
|
'gambar_url' => $this->gambar_url,
|
|
'penulis' => $this->penulis,
|
|
'status' => $this->status,
|
|
'created_at' => $this->created_at,
|
|
'updated_at' => $this->updated_at,
|
|
];
|
|
}
|
|
}
|