📜  laravel sortby 关系列 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:53:47.847000             🧑  作者: Mango

代码示例2
add the code to relationship in the method of the model
   public function room(){
      return $this->hasMany(room::class,  'id')->orderBy('id', 'DESC') ;
}