Esempio n. 1
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $universites = Universite::all();
     $user = User::find($id);
     if (Auth::user()->site_id == null) {
         $idUniversite = 0;
         $sites = null;
         $site = 0;
     } else {
         $idUniversite = DB::table('universite')->join('site', 'site.universite_id', '=', 'universite.universite_id')->join('users', 'users.site_id', '=', 'site.site_id')->select('universite.universite_id')->where('users.id', $id)->get()[0]->universite_id;
         $sites = DB::table('universite')->join('site', 'site.universite_id', '=', 'universite.universite_id')->select('site.*')->where('universite.universite_id', $idUniversite)->get();
         $site = DB::table('users')->join('site', 'users.site_id', '=', 'site.site_id')->select('site.*')->where('users.id', $id)->get()[0]->site_id;
     }
     return view('dashboard.profile.universite', ['user' => $user, 'universites' => $universites, 'sites' => $sites, 'siteCourant' => $site, 'universiteCourante' => $idUniversite]);
 }
 public function getList()
 {
     $sites = Site::all();
     $universites = Universite::all();
     return view('backoffice.sites', compact("sites", "universites"));
 }