當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。