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


PHP User::destroy方法代码示例

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


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

示例1: destroy

 public static function destroy($id)
 {
     self::check_logged_in();
     $user = new User(array('id' => $id));
     $user->destroy();
     Redirect::to('/user', array('message' => 'The user has been removed successfully!'));
 }
开发者ID:jackrl,项目名称:Tsoha-Bootstrap,代码行数:7,代码来源:users_controller.php

示例2: Eliminar

 public function Eliminar($id)
 {
     $persona = User::find($id)->persona;
     User::destroy($id);
     Persona::destroy($persona->id);
     return Redirect::to('admi')->with('status', 'ok_delete');
 }
开发者ID:gabitoooo,项目名称:inventarios,代码行数:7,代码来源:AdminController.php

示例3: userdelete

 public function userdelete($id)
 {
     $regno = USer::where('id', $id)->first();
     $data = $regno->regno;
     //        return $data;
     User::destroy($id);
     return Redirect::to('userlist')->with('deleted', $data . 'is deleted');
 }
开发者ID:KornelMbele,项目名称:ResultSystem,代码行数:8,代码来源:UserListController.php

示例4: destroy

 public static function destroy($id)
 {
     if (parent::is_admin() || parent::get_user_logged_in()->id == $id) {
         User::destroy($id);
         Redirect::to("/user", array('message' => "User was destroyed."));
     } else {
         Redirect::to("/", array('message' => "You are not an admin or user# " . $id));
     }
 }
开发者ID:tuureilmarinen,项目名称:tsoha,代码行数:9,代码来源:user_controller.php

示例5: destroy

 /**
  * Remove the specified user from storage.
  *
  * @param  int $id
  * @return Response
  */
 public function destroy($id)
 {
     try {
         $this->users->destroy($id);
         return $this->redirect('users.index');
     } catch (ModelNotFoundException $e) {
         return $this->redirectNotFound();
     }
 }
开发者ID:arwinjp,项目名称:ODTS,代码行数:15,代码来源:UsersController.php

示例6: destroy

 /**
  * destroy
  */
 public function destroy()
 {
     $res = new Response();
     if (User::destroy($this->id)) {
         $res->success = true;
         $res->message = 'Destroyed User ' . $this->id;
     } else {
         $res->message = "Failed to destroy User";
     }
     return $res->to_json();
 }
开发者ID:hcvcastro,项目名称:pxp,代码行数:14,代码来源:users.php

示例7: testSaveOnNewRecordusingSetters

 public function testSaveOnNewRecordusingSetters()
 {
     $obj = new User();
     $obj->name = 'bob5000';
     $obj->my_int = 10000;
     $this->assertTrue($obj->save());
     $this->assertTrue(User::exists('name', 'bob5000'));
     $this->assertEquals($obj->name, 'bob5000');
     $this->assertEquals($obj->my_int, 10000);
     $obj->destroy();
 }
开发者ID:scottdavis,项目名称:nimblize,代码行数:11,代码来源:UsageTest.php

示例8: set_destroy_post

 public function set_destroy_post()
 {
     $UserList = new ObjList();
     $UserList->construct_db(array('db_where_Arr' => array('status' => -1), 'db_where_deletenull_Bln' => TRUE, 'model_name_Str' => 'User', 'limitstart_Num' => 0, 'limitcount_Num' => 100));
     foreach ($UserList->obj_Arr as $key => $value_user) {
         $User = new User(['uid_Num' => $value_user->uid_Num]);
         $User->destroy();
     }
     if (!empty($UserList->obj_Arr)) {
         $this->load->model('Message');
         $this->Message->show(array('message' => '銷毀成功', 'url' => 'admin/base/user/set/set'));
     } else {
         $this->load->model('Message');
         $this->Message->show(array('message' => '已無可銷毀的項目', 'url' => 'admin/base/user/set/set'));
     }
 }
开发者ID:fansWoo,项目名称:win_the_world,代码行数:16,代码来源:Set.php

示例9: destroy

 public static function destroy($id)
 {
     self::check_logged_in();
     $destroyer = self::get_user_logged_in();
     $destroyerId = $destroyer->getId();
     //Kint::dump($destroyerId);
     if ($id == $destroyerId) {
         Redirect::to('/kayttaja/kayttajalista', array('message' => 'Et voi poistaa itseäsi!'));
     } else {
         //alustetaan User-olio annetulla id:llä
         $kayttaja = new User(array('kayttajaid' => $id));
         //kutsutaan User-luokan metodia destroy, joka poistaa kyselyn sen id:llä
         $kayttaja->destroy();
         Redirect::to('/kayttaja/kayttajalista', array('message' => 'Käyttäjä on poistettu onnistuneesti!'));
     }
 }
开发者ID:osla,项目名称:Tsoha-Bootstrap,代码行数:16,代码来源:user_controller.php

示例10: send

 /**
  * Composes and sends email with provided data.
  * 
  * @param  string $view
  * @param  array  $data 
  * @param  string $email
  * @param  string $subject
  * @return void
  */
 public function send($view, $data, $email = null, $subject = null)
 {
     if (!$email) {
         $email = $data['email'];
     }
     if (!$subject) {
         $subject = $data['subject'];
     }
     try {
         Mail::send($view, $data, function ($message) use($data, $email, $subject) {
             $message->to($email)->subject($subject);
         });
     } catch (\Swift_TransportException $e) {
         \User::destroy($data['id']);
         throw new \Swift_TransportException($e->getMessage());
     }
 }
开发者ID:onlystar1991,项目名称:mtdb,代码行数:26,代码来源:Mailer.php

示例11: array

//3. возможность добавить нового пользователя;
//можно сделать разными способами
// 1ый: создать объект юзера и вызвать метод save()
echo '<h3> 3 </h3>';
$params = array('name' => 'new user 1', 'birth' => '1991-07-25');
$user_1 = new User($params);
$user_1->save();
// 2ой: вызвать статический метод класса User create()
$params['name'] = 'new user 2';
$user_2 = User::create($params);
$result = DB::query('SELECT * FROM users_tbl WHERE id=' . $user_1->id . ';');
echo 'Try to find first created user:<br/>num rows:' . $result->num_rows;
$result = DB::query('SELECT * FROM users_tbl WHERE id=' . $user_2->id . ';');
echo '<br/>Try to find second created user:<br/>num rows:' . $result->num_rows;
//4. возможность добавить для пользователя номер мобильного телефона;
echo '<h3> 4 </h3>';
$user->add_phone_number('380953326461');
echo 'Users\'s telephones:<ul>';
foreach ($user->phones as $phone) {
    echo '<li>' . $phone->formated_phone . '</li>';
}
echo '</ul>';
//5. возможность удалить всю информацию о пользователе вместе с номерами телефонов;
echo '<h3> 5 </h3>';
$user->destroy();
$user_1->destroy();
$user_2->destroy();
$result = DB::query('SELECT * FROM users_tbl WHERE id=' . $id);
echo 'Try find deleted user:<br/>num rows: ' . $result->num_rows;
$result = DB::query('SELECT * FROM phones_tbl WHERE user_id=' . $id);
echo '<br/>Try find deleted user\'s phone numbers:<br/>num rows: ' . $result->num_rows;
开发者ID:nomid,项目名称:forforce,代码行数:31,代码来源:index.php

示例12: destroy

 /**
  * ELimina el estudiante especificado de la base de datos
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($admin, $id)
 {
     $user = User::findOrFail($id);
     if (User::destroy($id)) {
         $this->log_action('Estudiante Eliminado', 'El Estudiante "' . $user->name . '" ha sido eliminado.');
         Session::flash('msj', 'El estudiante ha sido eliminado exitosamente');
         return Redirect::route('admin.users.index', ['admin' => $admin]);
     } else {
         Session::flash('msj', 'Hubo un error y el Estudiante no pudo ser eliminado');
         Session::flash('msj_fallido', 'Hubo un error y el Estudiante no pudo ser eliminado');
         return Redirect::route('admin.users.index', ['admin' => $admin]);
     }
 }
开发者ID:betancourtfran,项目名称:tep,代码行数:19,代码来源:UsersController.php

示例13: destroy

 /**
  * Remove the specified user from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     if ($id == Auth::user()->id) {
         return Redirect::back()->with('message', 'Could not delete own account')->with('alert-class', 'danger');
     }
     User::destroy($id);
     return Redirect::route('users.index')->with('message', 'Deleted user')->with('alert-class', 'success');
 }
开发者ID:razerbite,项目名称:frisco_foundry,代码行数:14,代码来源:UsersController.php

示例14: destroy

 /**
  * Remove the specified user from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     User::destroy($id);
     return Redirect::route('users.index');
 }
开发者ID:hopshoppub,项目名称:hopshop.dev,代码行数:11,代码来源:UsersController.php

示例15: destroy

    public function destroy($id)
    {
        //Message that's returned
        $msg = '<div class="alert alert-warning alert-dismissible col-md-12" role="alert">
					  <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
					 	User Deleted!
				</div>';
        //Delete userinfo with that user's data
        Userinfo::deleteUser($id);
        //Delete user
        User::findOrFail($id);
        User::destroy($id);
        return Redirect::to('admin')->with('message', $msg);
    }
开发者ID:sudroid,项目名称:comicake,代码行数:14,代码来源:UsersController.php


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