Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function getPerson()
- {
- return view('show');
- }
- public function getInfo($id) {
- $user_info1 = user_info1::where('user_id',$id)->get();
- $data['data'] = DB::table('personal_infos')->get()->orderby('upload_time');
- return view('test', compact('user_info1','data'));//redirect user who log in to see person info
- }
- @foreach($data as $data1)
- @foreach ($data1->userinfo1s as $test)
- <p>{{ $test->hobby }}</p>
- @endforeach
- @endforeach
- Route::get('user/show/{id}','HomeController@getInfo')->name("user.show");
- class personal_info extends Eloquent
- {
- protected $fillable = array('Email', 'Name', 'Mobile_No');
- protected $table = 'personal_infos';
- protected $primaryKey = 'id';
- public function user_infos() {
- return $this->hasMany('Appuser_info,'user_id');
- }
- public function user_info1s() {
- return $this->hasMany('Appuser_info1','user_id');
- }
- }
- class user_info1 extends Eloquent
- {
- protected $fillable = array('hobby','user_id');
- public function personal_infos() {
- return $this->belongsTo('Apppersonal_info', 'user_id', 'id');
- }
- }
Add Comment
Please, Sign In to add comment