在我的控制器中使用DD我有这个结果。现在我想获得“id”:45列名称数据
控制器:
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);