DB Facade 方式:
使用 select()
$users = DB::table('users')->select('name', 'email as user_email')->get();
Eloquent ORM 方式:
使用 select() 或直接将列名数组作为参数传入 all()/get()/find() 等方法中,以下语句均可。
$users = User::select(['name'])->get();
$users = User::all(['name']);
$users = User::where('homepage','www.02405.com')->get(['id', 'name']);
$user = User::find($user_id, ['name']);