Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel sortby relationship column

add the code to relationship in the method of the model
   public function room(){
      return $this->hasMany(room::class,  'id')->orderBy('id', 'DESC') ;
}
Source by laracasts.com #
 
PREVIOUS NEXT
Tagged: #laravel #sortby #relationship #column
ADD COMMENT
Topic
Name
3+4 =