resource; $createdAt = $this->getFormattedAt(); return [ 'id' => $role->id, 'name' => $role->name, 'title' => $role->title, 'level' => $role->level, 'formatted_created_at' => $createdAt, 'abilities' => $role->getAbilities(), ]; } /** * The creation date in the date format of the company owning the role. * * The format follows the role's own scope, not the company the reader is * looking in from. */ public function getFormattedAt() { $format = CompanySetting::getSetting('carbon_date_format', $this->scope); return Carbon::parse($this->created_at)->translatedFormat($format); } }