支持插件名称和描述多语言
This commit is contained in:
parent
6b125a0aa9
commit
74f8cdafe9
|
|
@ -16,13 +16,18 @@ class PluginResource extends JsonResource
|
|||
*/
|
||||
public function toArray($request): array
|
||||
{
|
||||
$currentLocale = locale();
|
||||
|
||||
$name = is_array($this->name) ? ($this->name[$currentLocale] ?? '') : (string) $this->name;
|
||||
$description = is_array($this->description) ? ($this->description[$currentLocale] ?? '') : (string) $this->description;
|
||||
|
||||
$data = [
|
||||
'name' => $this->name,
|
||||
'code' => $this->code,
|
||||
'name' => $name,
|
||||
'description' => $description,
|
||||
'path' => $this->path,
|
||||
'version' => $this->version,
|
||||
'dir_name' => $this->dirName,
|
||||
'path' => $this->path,
|
||||
'code' => $this->code,
|
||||
'description' => $this->description,
|
||||
'type' => $this->type,
|
||||
'type_format' => trans('admin/plugin.' . $this->type),
|
||||
'icon' => plugin_resize($this->code, $this->icon),
|
||||
|
|
|
|||
|
|
@ -66,14 +66,14 @@ class Plugin implements Arrayable, \ArrayAccess
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function setName(string $name): self
|
||||
public function setName(string|array $name): self
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setDescription(string $description): self
|
||||
public function setDescription(string|array $description): self
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue