当前位置: 首页>>代码示例>>PHP>>正文


PHP User::onlyTrashed方法代码示例

本文整理汇总了PHP中app\User::onlyTrashed方法的典型用法代码示例。如果您正苦于以下问题:PHP User::onlyTrashed方法的具体用法?PHP User::onlyTrashed怎么用?PHP User::onlyTrashed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\User的用法示例。


在下文中一共展示了User::onlyTrashed方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: users

 public function users()
 {
     if (Auth::check()) {
         $users = User::all();
         $softDeletedUsers = User::onlyTrashed()->get();
         $winners = Winner::all();
         return view('admin/users', compact('users', 'softDeletedUsers', 'winners'));
     } else {
         return view('errors/404');
     }
 }
开发者ID:kristofsw,项目名称:webdev.comp,代码行数:11,代码来源:AdminController.php

示例2: getIndex

 /**
  * Show a list of all the users.
  *
  * @return View
  */
 public function getIndex()
 {
     // Grab all the users
     $users = User::All();
     // Do we want to include the deleted users?
     if (Input::get('withTrashed')) {
         $users = User::withTrashed()->get();
     } elseif (Input::get('onlyTrashed')) {
         $users = User::onlyTrashed()->get();
     }
     // Show the page
     return View::make('admin.users.index', compact('users'));
 }
开发者ID:chungyang,项目名称:CSE4701,代码行数:18,代码来源:UsersController.php

示例3: restore

 public function restore($id)
 {
     $id = intval($id);
     $userInstance = User::onlyTrashed()->findOrFail($id);
     $userInstance->comments->each(function ($comment) {
         Comment::withTrashed()->find($comment->id)->restore();
     });
     if ($userInstance->restore()) {
         return redirect()->back()->with('success', 'restore success');
     } else {
         return redirect()->back()->withError('this user haven\'t been deleted yet.');
     }
 }
开发者ID:Albertao,项目名称:myblog,代码行数:13,代码来源:UserAdminController.php

示例4: getDeletedUsersPaginated

 /**
  * @param $per_page
  * @return \Illuminate\Pagination\Paginator
  */
 public function getDeletedUsersPaginated($per_page)
 {
     return User::onlyTrashed()->paginate($per_page);
 }
开发者ID:jenamiles,项目名称:laravel-5-boilerplate,代码行数:8,代码来源:EloquentUserRepository.php

示例5: restaurar

 public function restaurar(Request $request)
 {
     $datos = User::onlyTrashed($request->id)->restore();
     $datos = User::onlyTrashed($request->buscar)->OrderBy('id', 'ASC')->paginate(5);
     Flash::success("Se ha Resturado de forma exitosa!");
     return view('usuarios.index')->with('datos', $datos)->with('buscar', $request->buscar);
 }
开发者ID:jlobaton,项目名称:inventario,代码行数:7,代码来源:UsersController.php

示例6: restore

 public function restore($id)
 {
     $user = User::onlyTrashed()->where('id', $id)->restore();
     $users = User::withTrashed()->get();
     $restore = "RESTORED";
     return view('listUsers')->with(compact('restore'))->with(compact('users'));
 }
开发者ID:jayyzhao,项目名称:UTSSEP,代码行数:7,代码来源:UsersController.php

示例7: testRestoreFromTrash

 public function testRestoreFromTrash()
 {
     $credentials = ['email' => 'admin@example.com', 'password' => '123456'];
     $token = JWTAuth::attempt($credentials);
     // test find not found
     $res = $this->call('POST', '/users/5/restore', [], [], [], ['HTTP_Authorization' => "Bearer {$token}"]);
     $this->assertEquals('404', $res->getStatusCode());
     // test restore user
     $user = factory(App\User::class)->create();
     $res = $this->call('POST', '/users/' . $user->id . '/trash', [], [], [], ['HTTP_Authorization' => "Bearer {$token}"]);
     $res = $this->call('POST', '/users/' . $user->id . '/restore', [], [], [], ['HTTP_Authorization' => "Bearer {$token}"]);
     $this->assertEquals('204', $res->getStatusCode());
     $exists = App\User::find($user->id);
     $this->assertEquals($user->name, $exists->name);
     $existsTrash = App\User::onlyTrashed()->count();
     $this->assertEquals(0, $existsTrash);
 }
开发者ID:wyrover,项目名称:laravel-users,代码行数:17,代码来源:UserControllerTest.php

示例8: getDeletedUsers

 /**
  * Show a list of all the deleted users.
  *
  * @return View
  */
 public function getDeletedUsers()
 {
     // Grab deleted users
     $users = User::onlyTrashed()->get();
     // Show the page
     return View('admin/deleted_users', compact('users'));
 }
开发者ID:jeremyreese,项目名称:quotes,代码行数:12,代码来源:UsersController.php

示例9: restoreFromTrash

 /**
  * restore user
  * @param  int $id
  * @return Response
  */
 public function restoreFromTrash($id)
 {
     $user = AppUser::onlyTrashed()->where('id', $id);
     if (!$user->count()) {
         return response()->json(null, 404);
     }
     if (!$user->restore()) {
         return response()->json(null, 500);
         // @codeCoverageIgnore
     }
     return response()->json(null, 204);
 }
开发者ID:autn,项目名称:gcl-users,代码行数:17,代码来源:UserController.php

示例10: pardonUser

 public function pardonUser($id)
 {
     User::onlyTrashed()->where('id', '=', $id)->restore();
     return true;
 }
开发者ID:kristofsw,项目名称:webdev.comp,代码行数:5,代码来源:User.php

示例11: portalRestoreEmployee

    protected function portalRestoreEmployee($id) {
        
        if ( \Auth::user() ) {
            
            $userTypeID = \Auth::user()->userTypeId;
            
            if ( $userTypeID == 1 ) {
                
                $empId = $id;
            
                $employee = Employee::onlyTrashed()->where('id','=',$empId)->first();

                $empUserId = $employee->userId;

                $user = User::onlyTrashed()->where('id','=',$empUserId)->first();

                $timesheet = Timesheet::onlyTrashed()->where('empId','=',$empId)->first();

                $employee->restore();
                $user->restore();
                $timesheet->restore();

                return Redirect::to('/portal-employees');
                
            } else if ( $userTypeID == 2 ) {
              
                return Redirect::to('/portal-settings');
                
            } else {

                return Redirect::to('/account');

            }
            
        } else {
            
            return Redirect::to('/');
            
        }
        
    }
开发者ID:JesHerArt,项目名称:ASL,代码行数:41,代码来源:EmployeesController.php

示例12: index

 /**
  * @param bool $trashed
  * @return \Illuminate\View\View
  */
 public function index($trashed = false)
 {
     $data = ['users' => !$trashed ? $this->user->orderBy('lastname', 'ASC')->paginate($this->config->items_per_page) : $this->user->onlyTrashed()->orderBy('name', 'ASC')->paginate($this->config->items_per_page), 'trashed' => $trashed];
     return view('blogify::admin.users.index', $data);
 }
开发者ID:raccoonsoftware,项目名称:Blogify,代码行数:9,代码来源:UserController.php


注:本文中的app\User::onlyTrashed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。