php - how to get and display my site name from other table (laravel) -


i wanted create view able list site user have admin rights.

how pass , show site name in view? let user id no 1, view show site name have admin rights.

i use people_site (admins) table record rights.

sites table: -------------------- id  | site_name | address  101 | abc       | 2131 102 | cde       | 23212 103 | efg       | 23231 104 | hij       | 1234  peoples table: -------------------- id  | first_name | last_name | paswword 1   | alex       | lee       | ******* 2   | bryan      | john      | *******   people_site (admin )table: -------------------- id  | people_id | site_id 101 | 1         | 101 102 | 1         | 102 103 | 2         | 103 104 | 1         | 104 105 | 2         | 101 

controller:

public function getmanage(){     return view::make('account.manage')         ->with('admins', admin::where('people_id', '=', auth::user()->id)->orderby('updated_at', 'desc')->get()); } 

view:

<ul>     @foreach($admins $admin)     <li><a href="">{{$admin->id}} </a></li>     @endforeach </ul> 

**people models: **

public function sites(){     return $this->hasmany('site'); } 

site models:

public function peoples(){     return $this->belongstomany('people'); } 

have column user type using id not have user types/admin , normal , can retrieve based on column type type ="admin" , hope got idea saying.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -