本文整理汇总了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!'));
}
示例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');
}
示例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');
}
示例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));
}
}
示例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();
}
}
示例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();
}
示例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();
}
示例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'));
}
}
示例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!'));
}
}
示例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());
}
}
示例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;
示例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]);
}
}
示例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');
}
示例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');
}
示例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">×</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);
}