Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel child relation order by desc


// order one relation with a specific order 
Model::with(['relation1'])
        ->with(['relation2' => function($query)  {
            $query->orderBy('relation2_column_name','DESC');
           }
        ])
         ->where('slug', $slug)->first();
 
PREVIOUS NEXT
Tagged: #laravel #child #relation #order #desc
ADD COMMENT
Topic
Name
4+5 =