mirror of
https://github.com/koel/koel
synced 2024-12-19 17:13:09 +00:00
24 lines
676 B
PHP
24 lines
676 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Http\Resources;
|
||
|
|
||
|
use Carbon\Carbon;
|
||
|
|
||
|
class CollaborativeSongResource extends SongResource
|
||
|
{
|
||
|
/** @return array<mixed> */
|
||
|
public function toArray($request): array
|
||
|
{
|
||
|
return array_merge(parent::toArray($request), [
|
||
|
'collaboration' => [
|
||
|
'user' => [
|
||
|
'avatar' => gravatar($this->song->collaborator_email),
|
||
|
'name' => $this->song->collaborator_name,
|
||
|
],
|
||
|
'added_at' => $this->song->added_at,
|
||
|
'fmt_added_at' => $this->song->added_at ? Carbon::make($this->song->added_at)->diffForHumans() : null,
|
||
|
],
|
||
|
]);
|
||
|
}
|
||
|
}
|