How to Select Certain Fields in Laravel Eloquent?

后端 未结 5 834
野性不改
野性不改 2021-01-04 10:09

How to Do following Query in Laravel Eloquent?

SELECT catID, catName, imgPath FROM categories WHERE catType = \"Root\"

I have tried followi

5条回答
  •  迷失自我
    2021-01-04 10:31

    Selecting multiple columns

    CategoryModel::get(['catName', 'catID', 'imgPath']);
    

    Works with Laravel 5.3 too!

提交回复
热议问题