Exemplo n.º 1
0
 public static function boot()
 {
     parent::boot();
     User::created(function ($user) {
         // Setup default user settings for the new user
         $usettings = UserSetting::lists('default', 'id')->toArray();
         if ($usettings) {
             foreach ($usettings as $id => $value) {
                 $user_settings[$id] = ['value' => $value];
             }
             $user->settings()->sync($user_settings);
         }
     });
 }
Exemplo n.º 2
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $user = $this->user->with('settings')->whereId($id)->first();
     $settings = UserSetting::select('id', 'name', 'key', 'default')->orderBy('key', 'DESC')->get();
     return view('berrier::admin.users.edit')->with(compact('user'))->with(compact('settings'));
 }