コード例 #1
0
ファイル: UsersController.php プロジェクト: BP4U/BFAdminCP
 /**
  * Show the editing page
  *
  * @param integer $id User ID
  */
 public function edit($id)
 {
     try {
         // If the user we are editing is the current logged in user don't refetch them.
         if ($this->isLoggedIn && $this->user->id == $id) {
             $user = $this->user;
         } else {
             $user = User::findOrFail($id);
         }
         // Get the list of roles
         $roles = Role::lists('name', 'id');
         // Set the page title
         $page_title = Lang::get('navigation.admin.site.items.users.items.edit.title', ['id' => $id]);
         // Populate the form fields with the user information
         Former::populate($user);
         return View::make('admin.site.users.edit', compact('user', 'page_title', 'roles'));
     } catch (ModelNotFoundException $e) {
         $this->messages[] = Lang::get('alerts.user.invlid', ['userid' => $id]);
         return Redirect::route('admin.site.users.index')->withErrors($this->messages);
     }
 }