public function totalArticles(){
return $this->updates()->count() + $this->events()->count();
}}
here is my model and i wanna use orderBy for this to order form min to max.
public function totalArticles(){
return $this->updates()->count() + $this->events()->count();
}}
here is my model and i wanna use orderBy for this to order form min to max.
If you want get records order by created_date
Ascending:
$result = ModelName::latest();
Descending:
$result = ModelName::oldest();
Other than date
$result = ModelName::orderBy('id', 'ASC')->get(); // ascending
$result = ModelName::orderBy('id', 'DESC')->get(); // descending