Skip to content

Instantly share code, notes, and snippets.

@ahmad-moussawi
Created May 5, 2014 13:39
Show Gist options
  • Save ahmad-moussawi/d924e3570a3af8b3b183 to your computer and use it in GitHub Desktop.
Save ahmad-moussawi/d924e3570a3af8b3b183 to your computer and use it in GitHub Desktop.
<?php
class News extends Eloquent{
public function scopeLang($query)
{
return $query->where('LocalString.lang', LANG);
}
public function Title()
{
return $this->belongsTo('LocalString', 'ls_title');
}
public function Description(){
return $this->belongsTo('LocalString', 'ls_description');
}
}
/**
select * from News
join localstring on ls_title = localstring.primarykey
join localstring on ls_description = localstring.primarykey
where localstring.langid = EN
where id = 5;
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment