mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-07 13:41:23 +00:00
* fix dropdown action Estimate Dashboard and fix translating full Dasboard page * Update app.php * fix locale in app.php config * Wizard install with translation, customer portal with translation, and fixing hardcoding strings to get translation * fixes asked to review * fixes pint --------- Co-authored-by: Max <contact@agencetwogether.fr> Co-authored-by: Darko Gjorgjijoski <5760249+gdarko@users.noreply.github.com>
35 lines
855 B
PHP
35 lines
855 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use App\Models\CompanySetting;
|
|
use Carbon\Carbon;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class RoleResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
*/
|
|
public function toArray($request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'name' => $this->name,
|
|
'title' => $this->title,
|
|
'level' => $this->level,
|
|
'formatted_created_at' => $this->getFormattedAt(),
|
|
'abilities' => $this->getAbilities(),
|
|
];
|
|
}
|
|
|
|
public function getFormattedAt()
|
|
{
|
|
$dateFormat = CompanySetting::getSetting('carbon_date_format', $this->scope);
|
|
|
|
return Carbon::parse($this->created_at)->translatedFormat($dateFormat);
|
|
}
|
|
}
|