{"action":"created","issue":{"url":"https://api.github.com/repos/avenirer/CodeIgniter-MY_Model/issues/3","labels_url":"https://api.github.com/repos/avenirer/CodeIgniter-MY_Model/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/avenirer/CodeIgniter-MY_Model/issues/3/comments","events_url":"https://api.github.com/repos/avenirer/CodeIgniter-MY_Model/issues/3/events","html_url":"https://github.com/avenirer/CodeIgniter-MY_Model/issues/3","id":60115056,"number":3,"title":"Issue with $this->entree_model->with('user')->get_all()","user":{"login":"faycal1","id":1731200,"avatar_url":"https://avatars.githubusercontent.com/u/1731200?v=3","gravatar_id":"","url":"https://api.github.com/users/faycal1","html_url":"https://github.com/faycal1","followers_url":"https://api.github.com/users/faycal1/followers","following_url":"https://api.github.com/users/faycal1/following{/other_user}","gists_url":"https://api.github.com/users/faycal1/gists{/gist_id}","starred_url":"https://api.github.com/users/faycal1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/faycal1/subscriptions","organizations_url":"https://api.github.com/users/faycal1/orgs","repos_url":"https://api.github.com/users/faycal1/repos","events_url":"https://api.github.com/users/faycal1/events{/privacy}","received_events_url":"https://api.github.com/users/faycal1/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":30,"created_at":"2015-03-06T15:21:33Z","updated_at":"2015-03-10T20:03:40Z","closed_at":null,"body":"Hi , \r\nFirst of all i want to thank you for the My_Model class it is very helpful ,\r\n\r\nBut i think there is an issue when i call $this->entree_model->with('user')->get_all(),\r\nif there is tow (02) records with the same user it will display the user data only with the last entree , but it work fine if every entree has a diffrent user , sorry if it is not wll explained , is not my native language\r\n\r\nThank you  "},"comment":{"url":"https://api.github.com/repos/avenirer/CodeIgniter-MY_Model/issues/comments/78136010","html_url":"https://github.com/avenirer/CodeIgniter-MY_Model/issues/3#issuecomment-78136010","issue_url":"https://api.github.com/repos/avenirer/CodeIgniter-MY_Model/issues/3","id":78136010,"user":{"login":"ngangchill","id":4242225,"avatar_url":"https://avatars.githubusercontent.com/u/4242225?v=3","gravatar_id":"","url":"https://api.github.com/users/ngangchill","html_url":"https://github.com/ngangchill","followers_url":"https://api.github.com/users/ngangchill/followers","following_url":"https://api.github.com/users/ngangchill/following{/other_user}","gists_url":"https://api.github.com/users/ngangchill/gists{/gist_id}","starred_url":"https://api.github.com/users/ngangchill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ngangchill/subscriptions","organizations_url":"https://api.github.com/users/ngangchill/orgs","repos_url":"https://api.github.com/users/ngangchill/repos","events_url":"https://api.github.com/users/ngangchill/events{/privacy}","received_events_url":"https://api.github.com/users/ngangchill/received_events","type":"User","site_admin":false},"created_at":"2015-03-10T20:03:40Z","updated_at":"2015-03-10T20:03:40Z","body":"in laravel elequent:\r\n\r\nEager Loading\r\n\r\nEager loading exists to alleviate the N + 1 query problem. For example, consider a Book model that is related to Author. The relationship is defined like so:\r\n\r\nclass Book extends Model {\r\n\r\n    public function author()\r\n    {\r\n        return $this->belongsTo('App\\Author');\r\n    }\r\n\r\n}\r\nNow, consider the following code:\r\n\r\nforeach (Book::all() as $book)\r\n{\r\n    echo $book->author->name;\r\n}\r\nThis loop will execute 1 query to retrieve all of the books on the table, then another query for each book to retrieve the author. So, if we have 25 books, this loop would run 26 queries.\r\n\r\nThankfully, we can use eager loading to drastically reduce the number of queries. The relationships that should be eager loaded may be specified via the with method:\r\n\r\nforeach (Book::with('author')->get() as $book)\r\n{\r\n    echo $book->author->name;\r\n}\r\nIn the loop above, only two queries will be executed:\r\n\r\nselect * from books\r\n\r\nselect * from authors where id in (1, 2, 3, 4, 5, ...)\r\nWise use of eager loading can drastically increase the performance of your application.\r\n\r\nOf course, you may eager load multiple relationships at one time:\r\n\r\n$books = Book::with('author', 'publisher')->get();\r\nYou may even eager load nested relationships:\r\n\r\n$books = Book::with('author.contacts')->get();\r\nIn the example above, the author relationship will be eager loaded, and the author's contacts relation will also be loaded.\r\n\r\n\r\n\r\n"}}