Example #1
0
 public function getTagListAttributeRu()
 {
     if (isset($this->id)) {
         $postId = $this->id;
         // Post ID
         $result = \Model\Tag\Tag::where('lang', '=', 'ru')->get();
         $tagsRu = $this->tags->lists('id')->toArray();
         $array = [];
         foreach ($result as $row) {
             foreach ($tagsRu as $tagRu) {
                 if ($tagRu == $row->id) {
                     $array[] = $row;
                 }
             }
         }
         return $array;
     } else {
         return [];
     }
 }
Example #2
0
 public function Tags(Request $request)
 {
     $tags = \Model\Tag\Tag::where('name', 'LIKE', $request->input('tag') . '%')->select('id', 'name as text')->take(10)->get();
     return response()->json($tags);
 }