Guest User

Untitled

a guest
Oct 16th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. public function getPerson()
  2. {
  3. return view('show');
  4. }
  5. public function getInfo($id) {
  6. $user_info1 = user_info1::where('user_id',$id)->get();
  7. $data['data'] = DB::table('personal_infos')->get()->orderby('upload_time');
  8. return view('test', compact('user_info1','data'));//redirect user who log in to see person info
  9. }
  10.  
  11. @foreach($data as $data1)
  12.  
  13.  
  14. @foreach ($data1->userinfo1s as $test)
  15. <p>{{ $test->hobby }}</p>
  16. @endforeach
  17.  
  18. @endforeach
  19.  
  20. Route::get('user/show/{id}','HomeController@getInfo')->name("user.show");
  21.  
  22. class personal_info extends Eloquent
  23. {
  24. protected $fillable = array('Email', 'Name', 'Mobile_No');
  25. protected $table = 'personal_infos';
  26. protected $primaryKey = 'id';
  27. public function user_infos() {
  28. return $this->hasMany('Appuser_info,'user_id');
  29. }
  30. public function user_info1s() {
  31. return $this->hasMany('Appuser_info1','user_id');
  32. }
  33. }
  34.  
  35. class user_info1 extends Eloquent
  36. {
  37. protected $fillable = array('hobby','user_id');
  38. public function personal_infos() {
  39. return $this->belongsTo('Apppersonal_info', 'user_id', 'id');
  40. }
  41. }
Add Comment
Please, Sign In to add comment