本文整理汇总了PHP中MY_Model::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP MY_Model::delete方法的具体用法?PHP MY_Model::delete怎么用?PHP MY_Model::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MY_Model
的用法示例。
在下文中一共展示了MY_Model::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
public function delete($field_id)
{
$this->db->where('field_id', $field_id);
$field = $this->db->get('mcb_fields')->row();
$this->drop_column($field->object_id, 'custom_' . $field->field_index);
parent::delete(array('field_id' => $field_id));
}
示例2: delete
public function delete($id)
{
// Delete a page
parent::delete($id);
// Reset parent ID for its children
$this->db->set(['parent_id' => 0])->where('parent_id', $id)->update($this->_table_name);
}
示例3: delete
public function delete($id)
{
/* Delete a page */
parent::delete($id);
/* Reset parent ID for its children */
$this->db->set(array('parent_id' => 0))->where('parent_id', $id)->update($this->_table_name);
}
示例4: delete
public function delete($tenancy_id)
{
$this->load->model('miniant/tenancy_log_model');
parent::delete($tenancy_id);
$this->tenancy_log_model->delete_tenancy($tenancy_id);
return null;
}
示例5: delete
public function delete($id)
{
$custom_field = $this->get_by_id($id);
$exists = $this->db->query("SHOW COLUMNS FROM `" . $custom_field->custom_field_table . "` LIKE " . $this->db->escape($custom_field->custom_field_column));
if ($exists->num_rows() == 1) {
$this->db->query("ALTER TABLE `" . $custom_field->custom_field_table . "` DROP `" . $custom_field->custom_field_column . "`");
}
parent::delete($id);
}
示例6: delete
function delete($id = 0)
{
$this->load->helper('file');
// Delete all files within the album
delete_files($this->albums_dir . $id, TRUE);
// Delete the album too
@rmdir($this->albums_dir . $id);
$this->db->delete('photos', array('album_id' => $id));
return parent::delete($id);
}
示例7: hapus_slide
public function hapus_slide($id = 0)
{
$data = parent::get($id);
if (file_exists($data->slide_image)) {
unlink($data->slide_image);
}
if (file_exists($data->slide_thumb)) {
unlink($data->slide_thumb);
}
parent::delete($id);
}
示例8: delete
/**
* Deletes a blog category only if it doesn't have any articles in it
* @param int $id Blog Category ID
* @return bool
*/
public function delete($id)
{
if (empty($id)) {
return FALSE;
}
// get portfolios by category id
$articles = $this->check_article_by_cat($id);
if (!empty((array) $articles)) {
return json_encode(array('error' => 1));
}
return parent::delete($id);
}
示例9: delete
public function delete($id_or_fields)
{
if (is_array($id_or_fields)) {
$job_sites = $this->get($id_or_fields);
} else {
$job_sites = array($this->get($id_or_fields));
}
$result = parent::delete($id_or_fields);
foreach ($job_sites as $job_site) {
$bookings = $this->booking_model->get(array('job_site_id' => $job_site->id));
foreach ($bookings as $booking) {
$this->booking_model->delete($booking->id);
}
}
$this->db->query("DELETE FROM `building_bookings` WHERE job_site_id NOT IN ( SELECT id FROM building_job_sites)");
return $result;
}
示例10: delete
public function delete($id_or_fields)
{
if (is_array($id_or_fields)) {
$tradesmen = $this->get($id_or_fields);
} else {
$tradesmen = array($this->get($id_or_fields));
}
$result = parent::delete($id_or_fields);
foreach ($tradesmen as $tradesman) {
$bookings = $this->booking_model->get(array('tradesman_id' => $tradesman->id));
foreach ($bookings as $booking) {
$this->booking_model->delete($booking->id);
}
}
$this->db->query("DELETE FROM `building_bookings` WHERE tradesman_id NOT IN ( SELECT id FROM building_tradesmen)");
return $result;
}
示例11: delete
public function delete($id_or_fields)
{
if (is_array($id_or_fields)) {
$bookings = $this->get($id_or_fields);
} else {
$bookings = array($this->get($id_or_fields));
}
$result = parent::delete($id_or_fields);
foreach ($bookings as $booking) {
$recipients = $this->booking_recipient_model->get(array('booking_id' => $booking->id));
foreach ($recipients as $recipient) {
$this->booking_recipient_model->delete($recipient->id);
}
}
$this->db->query("DELETE FROM `building_booking_recipients` WHERE booking_id NOT IN ( SELECT id FROM building_bookings)");
return $result;
}
示例12: delete
public function delete($client_id)
{
$this->load->model('invoices/mdl_invoices');
/* Delete the client record */
parent::delete(array('client_id' => $client_id));
/* Delete any related contacts */
$this->db->where('client_id', $client_id);
$this->db->delete('mcb_contacts');
/*
* Delete any related invoices, but use the invoice model so records
* related to the invoice are also deleted
*/
$this->db->select('invoice_id');
$this->db->where('client_id', $client_id);
$invoices = $this->db->get('mcb_invoices')->result();
foreach ($invoices as $invoice) {
$this->mdl_invoices->delete($invoice->invoice_id);
}
}
示例13: delete
function delete($id)
{
/*
TODO: This code does not work anymore. We should fix.
// Delete files from the file host.
if($data = $this->get_by_id($id))
{
switch($data['CMS_MediaStore'])
{
case 'rackspace-cloud-files':
$this->load->spark('cloudmanic-storage/1.0.4');
$this->storage->load_driver('rackspace-cf');
$this->storage->delete_file($this->data['cms']['cp_media_rackspace_container'], $data['CMS_MediaPath'] . $data['CMS_MediaFile']);
// Delete thumb
if($data['CMS_MediaIsImage'])
{
$this->storage->delete_file($this->data['cms']['cp_media_rackspace_container'], $data['CMS_MediaPathThumb'] . $data['CMS_MediaFileThumb']);
}
break;
case 'amazon-web-services-s3':
$this->load->spark('cloudmanic-storage/1.0.4');
$this->storage->load_driver('amazon-s3');
$this->storage->delete_file($this->data['cms']['cp_media_amazon_s3_container'], $data['CMS_MediaPath'] . $data['CMS_MediaFile']);
// Delete thumb
if($data['CMS_MediaIsImage'])
{
$this->storage->delete_file($this->data['cms']['cp_media_amazon_s3_container'], $data['CMS_MediaPathThumb'] . $data['CMS_MediaFileThumb']);
}
break;
case 'local-files':
@unlink($this->data['cms']['cp_media_local_dir'] . $data['CMS_MediaFile']);
@unlink($this->data['cms']['cp_media_local_dir'] . $data['CMS_MediaFileThumb']);
break;
}
}
*/
return parent::delete($id);
}
示例14: delete
/**
* In addition to deleting the user record, this also deletes associated contacts and role assignments
* @param int $user_id
* @return bool
*/
public function delete($user_id)
{
$user = $this->get($user_id);
$result = parent::delete($user_id);
if ($result) {
$contacts = $this->user_contact_model->get(array('user_id' => $user_id));
$roles = $this->get_roles($user_id);
if (!empty($contacts)) {
foreach ($contacts as $contact) {
$this->user_contact_model->delete($contact->id);
}
}
if (!empty($roles)) {
foreach ($roles as $role) {
$this->unassign_role($user_id, $role->id);
}
}
}
return $result;
}
示例15: delete
/**
* In addition to deleting this contact, if it is the default_choice, assign default_choice to another contact of the same type if it exists
* @param $contact_id ID of the contact detail
* @return boolean true unless something goes majorly wrong in SQL
*/
public function delete($contact_id)
{
$contact = $this->user_contact_model->get($contact_id, true);
$result = parent::delete($contact_id);
if (!$result) {
return false;
}
if ($contact->default_choice) {
$otherdefaultcontacts = $this->user_contact_model->get(array('user_id' => $contact->user_id, 'default_choice' => 1, 'type' => $contact->type), true);
// If at least one other contact is already default, do nothing else
if ($otherdefaultcontacts) {
return true;
}
$othernondefaultcontact = $this->user_contact_model->get(array('user_id' => $contact->user_id, 'default_choice' => 0, 'type' => $contact->type), true);
if (!empty($othernondefaultcontact)) {
$this->user_contact_model->edit($othernondefaultcontact->id, array('default_choice' => 1));
}
}
return true;
}