Query scope in different table using Laravel 4 -


I am using scope queries in my group list display, and the group belongs to the country table. I can use the group name as search and sort order without any problem.

Do I now want to do the following:

1) Name of the search country that is stored in the country table

2) Sort order of country Name stored in host country

  # group model # class group provides clues {secure $ table = 'group'; Protected $ guarded = array ('id'); Public celebration country () {return $ this- & gt; Affiliation ('country'); } Public Function ScopeName ($ query, $ name) {return $ query- & gt; Where ('group_name', 'likes', "% $ name%"); } Public Function SkopSortname ($ query, $ order_b = 'acc') {return $ query-> By command ('group_name', $ order_by); }} # Country model # class country provides clues {secure $ table = 'country'; Public Function Group () {Return $ this- & gt; Hayman ('group'); }} # Group controller # public function index () {// search group name $ group = group :: name ($ s_name); // command group name $ groups = $ group- & gt; Sortname ($ orderBy); } I do not think there is no such way by which I record using records.  

Can sort the table of other columns without being included in it. So in my controller I used it in the query.

  # group controller # public function index () {// Join table and country table $ group = group :: included ('country', 'country.id', '=' ',' Group.country_id '); // Search group name $ groups = $ groups-> Name ($ s_name); // command group name $ groups = $ group- & gt; Sortname ($ orderBy); }  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -