获取laravel通知中列内的数据

Get the data inside the column in laravel notification

在我的控制器中使用 DD 我得到了这个结果。现在我想在列名 "id":45 中获取 data

控制器:

 public function readbyid($id){

    $test = DB::table('notifications')->where('id','=', $id)->get();

 dd($test);}

Id 是唯一的,请使用 first 而不是 get

 $test = DB::table('notifications')->where('id', $id)->first();
 $dataId = $test->data->id;
 //or $dataId = json_decode($test->data)->id;
use App\Notification; 

$test = Notification::where('id', $id)->first();
$dataId = $test->id;
dd($dataId);

就在下面一行:

$notifications = auth()->user()->notifications->pluck('data')->flatten(1);