How to sort records in alphabetical order in Laravel

后端 未结 4 780
温柔的废话
温柔的废话 2020-12-17 19:17

How to sort records in alphabetical order in laravel?

public function index()
{
    $comproducts = Comproduct::paginate(3);

    $items = Item::orderBy(\'nam         


        
4条回答
  •  悲哀的现实
    2020-12-17 20:00

    Hi Please find an answer based on eloquent query laravel

    Table: Users Columns:id,name,class_id

    $users = DB::table('users')->whereIn('class_id', [1, 2, 3])->orderBy('name', 'ASC')->paginate(50);
    

提交回复
热议问题