如何从数据库中获取单个值而不是 laravel 中的数组?

how to fetch single value from database instead of array in laravel?

我正在使用以下查询。

$profile_status= DB::table('profiles')->select('profile_status')->where('id',$user_id)->pluck('profile_status');

返回:["created","created"]

我只想获取存储在 row.like 中的值:已创建

不需要在同一个查询中同时使用select和plug。你可以试试这个:

$profile_status=DB::table('profiles')->where('id', $user_id)->first()->profile_status;