Kaynağa Gözat

:construction: create

visuddhinanda 3 yıl önce
ebeveyn
işleme
4e8beef6a4

+ 41 - 0
app/Http/Resources/TermResource.php

@@ -0,0 +1,41 @@
+<?php
+
+namespace App\Http\Resources;
+
+use Illuminate\Http\Resources\Json\JsonResource;
+use App\Http\Api\ChannelApi;
+use App\Http\Api\StudioApi;
+use App\Http\Api\UserApi;
+
+class TermResource extends JsonResource
+{
+    /**
+     * Transform the resource into an array.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
+     */
+    public function toArray($request)
+    {
+        $data = [
+            "id"=>$this->id,
+            "guid"=>$this->guid,
+            "word"=> $this->word,
+            "word_en"=> $this->word_en,
+            "meaning"=> $this->meaning,
+            "other_meaning"=> $this->other_meaning,
+            "tag"=> $this->tag,
+            "note"=> $this->note,
+            "language"=> $this->language,
+            "channal"=> $this->channal,
+            "studio" => StudioApi::getById($this->owner),
+            "editor"=> UserApi::getById($this->editor_id),
+            "created_at"=> $this->created_at,
+            "updated_at"=> $this->updated_at,
+        ];
+        if(!empty($this->channal)){
+            $data["channel"] = ChannelApi::getById($this->channal);
+        }
+        return $data;
+    }
+}

+ 11 - 0
resources/mustache/nissaya_ending_card.tpl

@@ -0,0 +1,11 @@
+# {{ending}}-{{ending_tag}}
+
+**{{ending_meaning}}**
+
+{{ending_note}}
+
+|{{title_case}}|{{title_content}}|{{title_local_ending}}|{{title_local_relation}}|{{title_relation}}|
+|-|-|-|-|-|
+{{#row}}
+|**{{case}}**|{{summary}}|{{local_ending}}|{{local_relation}}|`{{relation}}`|
+{{/row}}