{"action":"created","issue":{"url":"https://api.github.com/repos/cybercog/laravel-love/issues/31","repository_url":"https://api.github.com/repos/cybercog/laravel-love","labels_url":"https://api.github.com/repos/cybercog/laravel-love/issues/31/labels{/name}","comments_url":"https://api.github.com/repos/cybercog/laravel-love/issues/31/comments","events_url":"https://api.github.com/repos/cybercog/laravel-love/issues/31/events","html_url":"https://github.com/cybercog/laravel-love/issues/31","id":381862320,"node_id":"MDU6SXNzdWUzODE4NjIzMjA=","number":31,"title":"problem with return the number of posts likes foreach post ","user":{"login":"alimuhnad","id":29497197,"node_id":"MDQ6VXNlcjI5NDk3MTk3","avatar_url":"https://avatars2.githubusercontent.com/u/29497197?v=4","gravatar_id":"","url":"https://api.github.com/users/alimuhnad","html_url":"https://github.com/alimuhnad","followers_url":"https://api.github.com/users/alimuhnad/followers","following_url":"https://api.github.com/users/alimuhnad/following{/other_user}","gists_url":"https://api.github.com/users/alimuhnad/gists{/gist_id}","starred_url":"https://api.github.com/users/alimuhnad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alimuhnad/subscriptions","organizations_url":"https://api.github.com/users/alimuhnad/orgs","repos_url":"https://api.github.com/users/alimuhnad/repos","events_url":"https://api.github.com/users/alimuhnad/events{/privacy}","received_events_url":"https://api.github.com/users/alimuhnad/received_events","type":"User","site_admin":false},"labels":[{"id":793294258,"node_id":"MDU6TGFiZWw3OTMyOTQyNTg=","url":"https://api.github.com/repos/cybercog/laravel-love/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-11-17T13:15:44Z","updated_at":"2018-11-17T14:30:53Z","closed_at":null,"author_association":"NONE","body":"hi i am using this plugin and i made \r\nuser table - profile table and posts table \r\nthis is my code \r\n===========================================>\r\n```php\r\n public function getfollowsposts()\r\n    {\r\n       $user= Auth::user();\r\n       $a=[];\r\n       $posts = User::find($user->id)->followings;\r\n        foreach ($posts as $value) {\r\n            $post =DB::table('users')\r\n        ->where('users.id','=',$value->id)\r\n        ->leftJoin('posts', 'users.id', '=', 'posts.user_id')\r\n        ->leftJoin('myprofiles', 'users.id', '=', 'myprofiles.user_id')\r\n        ->orderBy('posts.created_at', 'desc')\r\n        ->select('name','myprofiles.user_id','img_post','posts.created_at','posts.id','posts.title','myprofiles.avatar_pic')\r\n        ->get();\r\n            array_push($a,$post);\r\n        }\r\n        return response()->json($a,200);\r\n    }\r\n```\r\n====================================>\r\nhow can i get the number of likes for each code coz i tryed every single way and its not working\r\n====================>\r\n```php\r\n  public function postslikesnumber(Request $request){\r\n        $user = Auth::user();   \r\n        $x3= posts::find($request->posts_id)->likesCount;\r\n        return response()->json($x3, 200); \r\n    }\r\n```\r\n====================>>>>>>\r\nso......\r\ni made function that send request when the function getfollowsposts() loaded put its not good for \r\nthe server requests ....... too many requests \r\nso any help ??? i ll be thankfull \r\n"},"comment":{"url":"https://api.github.com/repos/cybercog/laravel-love/issues/comments/439621323","html_url":"https://github.com/cybercog/laravel-love/issues/31#issuecomment-439621323","issue_url":"https://api.github.com/repos/cybercog/laravel-love/issues/31","id":439621323,"node_id":"MDEyOklzc3VlQ29tbWVudDQzOTYyMTMyMw==","user":{"login":"alimuhnad","id":29497197,"node_id":"MDQ6VXNlcjI5NDk3MTk3","avatar_url":"https://avatars2.githubusercontent.com/u/29497197?v=4","gravatar_id":"","url":"https://api.github.com/users/alimuhnad","html_url":"https://github.com/alimuhnad","followers_url":"https://api.github.com/users/alimuhnad/followers","following_url":"https://api.github.com/users/alimuhnad/following{/other_user}","gists_url":"https://api.github.com/users/alimuhnad/gists{/gist_id}","starred_url":"https://api.github.com/users/alimuhnad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alimuhnad/subscriptions","organizations_url":"https://api.github.com/users/alimuhnad/orgs","repos_url":"https://api.github.com/users/alimuhnad/repos","events_url":"https://api.github.com/users/alimuhnad/events{/privacy}","received_events_url":"https://api.github.com/users/alimuhnad/received_events","type":"User","site_admin":false},"created_at":"2018-11-17T14:30:53Z","updated_at":"2018-11-17T14:30:53Z","author_association":"NONE","body":"how can i do it with  Eloquent to fetch all this data --------------- i ll try love_like_counters  right now "}}
{"actor":{"display_login":"alimuhnad"}}