【发布时间】:2019-06-06 01:33:03
【问题描述】:
我正在开发一个小型 Web 应用程序,它在数据库表中有一个 user_id 列和 jsonb 列 information,其中包含用户信息。我想在我的刀片文件中显示Auth::user() 信息。
information 列可能包含更多数组,这里是jsonb 列数据。
{"work": {"info": "work", "company": "Augnitive", "working_to": "2019-01-02", "designation": "Software Engineer", "working_from": "2019-01-01", "responsibilities": "Hello"}, "contact": {"info": "contact", "email": "ki.tushar21@gmail.com", "mobile": "01681654863", "address": "House 156, Sultangonj, Rayer Bazar Dhaka 1209, West Agargaon, West Agargaon", "facebook": "fb.com", "linkedin": "linkedin.com", "citizenship": "Bangladesh"}, "personal": {"bday": "2019-01-01", "info": "personal", "blood": "A(+VE)", "gender": "Male"}, "education": {"info": "education", "edu_type": "SSC", "institute": "PGJHS", "graduation": "2010"}}
我不知道如何在控制器的视图中显示这些数据
public function index()
{
$profile = Auth::user()->profile;
// return $profile;
return view('home')->with('profile',json_decode($profile,true));
}
【问题讨论】:
标签: json laravel controller laravel-blade jsonb