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


PHP User::delete方法代码示例

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


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

示例1: destroy

 public function destroy(User $user)
 {
     try {
         $user->delete();
         session()->flash('message_success', 'Delete successful!');
     } catch (ModelNotFoundException $e) {
         session()->flash('message_failed', 'Delete failed. The word you are trying to delete cannot be found.');
     }
     return redirect('/users/search');
 }
开发者ID:karlpandacan,项目名称:fels_rush,代码行数:10,代码来源:UserController.php

示例2: postRegister

 /**
  * Handles user registration
  *
  * @param RegisterRequest $request
  * @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  * @throws \Exception
  */
 public function postRegister(RegisterRequest $request)
 {
     $user = new User(['username' => $request->input('username'), 'password' => Hash::make($request->input('password')), 'email' => $request->input('email'), 'deleted_at' => date('Y-m-d H:i:s'), 'confirm_token' => Hash::make(time() . env('APP_KEY'))]);
     $user->save();
     $data = ['user_email' => $request->input('email'), 'username' => $request->input('username'), 'user_subject' => trans('users.successful_registration'), 'admin_subject' => trans('users.new_user_registered'), 'user_mail_data' => ['username' => $request->input('username'), 'link' => URL::to('users/confirm') . '?token=' . $user->confirm_token], 'admin_mail_data' => ['username' => $request->input('username'), 'email' => $request->input('email'), 'created_at' => $user->created_at]];
     $mail_send = $this->sendMail($data, 'emails.register', 'emails.new_user');
     if ($mail_send) {
         flash()->success(trans('users.register_success'));
         return redirect('/');
     } else {
         $user->delete();
         flash()->error(trans('users.registration_failed'));
         return redirect()->back()->withInput($request->input());
     }
 }
开发者ID:noikiy,项目名称:Laravel5Starter,代码行数:22,代码来源:UsersController.php

示例3: testCascadeModel

 public function testCascadeModel()
 {
     $user = new User(array('fullname' => 'Mukhamad Ikhsan', 'email' => 'some.email@email.com', 'password' => 'rahasia'));
     $this->assertTrue($user->save());
     $group = new Group(array('name' => "Testing"));
     $this->assertTrue($group->save());
     $user->addGroup($group);
     $this->assertTrue($user->save());
     $this->assertEqual(1, count($user->groups));
     $this->assertEqual(1, count($group->members));
     $ikhsan = User::getRepository()->findOneBy(array('email' => 'some.email@email.com'));
     $testing = Group::getRepository()->findOneBy(array('name' => 'Testing'));
     $this->assertEqual(1, count($ikhsan->groups));
     $this->assertEqual(1, count($testing->members));
     $user->delete();
     $group->delete();
 }
开发者ID:ncud,项目名称:sagalaya,代码行数:17,代码来源:ModelTest.php

示例4: destroyUser

 /**
  * Destroy a user.
  *
  * @param  App\Models\User $user
  * @return void
  */
 public function destroyUser(User $user)
 {
     $user->comments()->delete();
     $user->delete();
 }
开发者ID:raizeta,项目名称:laravel5-example,代码行数:11,代码来源:UserRepository.php

示例5: destroy

 /**
  * @param DeleteUsrRequest $request
  *
  * @param User $user
  * @return \Illuminate\Http\RedirectResponse|\Symfony\Component\HttpFoundation\Response
  * @throws \Exception
  */
 public function destroy(DeleteUsrRequest $request, User $user)
 {
     $this->data = $user->delete();
     return $this->handleRedirect($request, route('backend.users.index'));
 }
开发者ID:muhamadsyahril,项目名称:ecommerce-1,代码行数:12,代码来源:UsersController.php

示例6: delete

 function delete($user_id)
 {
     Auth::logout();
     User::delete($user_id);
     return redirect('user/register');
 }
开发者ID:eimg,项目名称:laravel-example,代码行数:6,代码来源:UserController.php

示例7: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy(User $user)
 {
     $affectedRows = $user->delete();
     return $affectedRows;
 }
开发者ID:berkapavel,项目名称:Laravel5-Time-Tracker-Project-manager,代码行数:11,代码来源:UsersController.php

示例8: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param User $user
  * @return \Illuminate\Http\RedirectResponse
  * @throws \Exception
  */
 public function destroy(User $user)
 {
     $user->delete();
     return redirect()->back();
 }
开发者ID:lyovkin,项目名称:elcoinbank,代码行数:12,代码来源:AdminUserController.php


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