本文整理汇总了PHP中Contact::destroy方法的典型用法代码示例。如果您正苦于以下问题:PHP Contact::destroy方法的具体用法?PHP Contact::destroy怎么用?PHP Contact::destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contact
的用法示例。
在下文中一共展示了Contact::destroy方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: destroy
function destroy($params)
{
if (empty($params['id'])) {
bail('Required parameter id not set.');
}
$contact = new Contact($params['id']);
$contact->destroy();
$this->redirectTo(array('controller' => 'Contact', 'action' => 'index'));
}
示例2: set_destroy_post
public function set_destroy_post()
{
$ContactList = new ObjList(['db_where_Arr' => ['status' => -1], 'db_where_deletenull_Bln' => TRUE, 'model_name_Str' => 'Contact', 'limitstart_Num' => 0, 'limitcount_Num' => 100]);
foreach ($ContactList->obj_Arr as $key => $value_contact) {
$Contact = new Contact(['contactid_Num' => $value_contact->contactid_Num]);
$Contact->destroy();
}
if (!empty($ContactList->obj_Arr)) {
$this->load->model('Message');
$this->Message->show(['message' => '銷毀成功', 'url' => 'admin/base/contact/set/set']);
} else {
$this->load->model('Message');
$this->Message->show(['message' => '已無可銷毀的項目', 'url' => 'admin/base/contact/set/set']);
}
}
示例3: destroy
public function destroy($id)
{
Contact::destroy($id);
return Response::json(["status" => "OK"]);
}
示例4: Address
if ($checkEmail == 0) {
if ($newContact->save()) {
$newAddress = new Address();
$newAddress->contactId = $newContact->id;
$newAddress->zipcode = $zipcode;
$newAddress->address = $address;
$newAddress->complement = $complement;
$newAddress->neighborhood = $neighborhood;
$newAddress->city = $city;
$newAddress->state = $state;
if ($newAddress->save()) {
$data['msg'] = 'Contact saved successfully!';
$data['id'] = $newContact->id;
} else {
$data['msg'] = 'An error occurred while saving the contact!';
Contact::destroy($newContact->id);
}
} else {
$data['msg'] = 'An error occurred while saving the contact!';
}
} else {
$data['msg'] = 'This email is already registered for a contact!';
}
$contactList->response()->header('Content-Type', 'application/json');
echo json_encode($data);
});
// Edit contact
$contactList->put("/contacts/:id", function ($id) use($contactList) {
$name = $contactList->request->params('name');
$email = $contactList->request->params('email');
$editContact = Contact::find($id);
示例5: destroy
/**
* Remove the specified Contact from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
Contact::destroy($id);
return Redirect::route('admin.contacts.index')->with('message', 'Data deleted successfully');
}
示例6: getDelete
/**
* Remove the specified resource from storage.
* DELETE /admin\admincontact/{id}
*
* @param int $id
* @return Response
*/
public function getDelete($id)
{
$delete = Contact::destroy($id);
Session::flash('message', 'Contact has been deleted Successfully');
return Redirect::to('admin/contacts');
}