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


PHP Model::destroy方法代码示例

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


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

示例1: delete

 /**
  * Find and delete a resource by ID.
  *
  * @param  int  $id
  * @return bool
  */
 public function delete($id)
 {
     $this->fireEvent('deleting', [$id]);
     $deleted = $this->model->destroy($id);
     $this->fireEvent('deleted', [$id, $deleted]);
     return $deleted;
 }
开发者ID:caffeinated,项目名称:beverage,代码行数:13,代码来源:AbstractEloquentRepository.php

示例2: destroy

 public static function destroy($params)
 {
     // Get delete position
     $deletePosition = $params["data"][0]["stepNumber"];
     // Destroy recipe step
     $returnArray = parent::destroy($params);
     // Check if we need to re-order existing steps
     if (isset($params["reorder"]) && $params["reorder"] == TRUE) {
         // Connect to database
         $mysqli = FoodAppDatabase::connect();
         // Update current data - decrement step numbers above insert position
         $queryString = "SELECT * FROM recipe_step WHERE food_id='" . $params["data"][0]["foodId"] . "' " . "ORDER BY step_number ASC";
         if ($result = $mysqli->query($queryString)) {
             while ($row = $result->fetch_assoc()) {
                 // Update current data
                 if ($row["step_number"] > $deletePosition) {
                     $queryStringUpdate = "UPDATE recipe_step SET step_number='" . ($row["step_number"] - 1) . "' WHERE id='" . $row["id"] . "'";
                     if (!$mysqli->query($queryStringUpdate)) {
                         throw new Exception($mysqli->error);
                     }
                 }
             }
         }
     }
     return $returnArray;
 }
开发者ID:ncowan15,项目名称:FoodApp3,代码行数:26,代码来源:recipeStep.php

示例3: delete

 static function delete($attachment_id, $file = true)
 {
     if ($file) {
         $attachment = new self($attachment_id);
         @unlink(uploaded($attachment->path, true));
     }
     parent::destroy(get_class(), $attachment_id);
 }
开发者ID:vito,项目名称:chyrp-site,代码行数:8,代码来源:model.Attachment.php

示例4: delete

 /**
  * Function: delete
  * See Also:
  *     <Model::destroy>
  */
 static function delete($id)
 {
     parent::destroy(get_class(), $id);
     SQL::current()->delete("post_attributes", array("post_id" => $id));
 }
开发者ID:relisher,项目名称:chyrp,代码行数:10,代码来源:Post.php

示例5: delete

 /**
  * Function: delete
  * Deletes the given milestone. Calls the "delete_milestone" trigger and passes the <Milestone> as an argument.
  *
  * Parameters:
  *     $id - The milestone to delete.
  */
 static function delete($id)
 {
     parent::destroy(get_class(), $id);
     if (module_enabled("cacher")) {
         Modules::$instances["cacher"]->regenerate();
     }
 }
开发者ID:vito,项目名称:chyrp-site,代码行数:14,代码来源:Milestone.php

示例6: delete

 /**
  * Function: delete
  * Deletes the given page.
  * 
  * Calls the @delete_page@ trigger with the <Page> to delete.
  *
  * Parameters:
  *     $page_id - The page to delete.
  *     $recursive - Should the page's children be deleted? (default: false)
  */
 static function delete($page_id, $recursive = false)
 {
     if ($recursive) {
         $page = new self($page_id);
         foreach ($page->children as $child) {
             self::delete($child->id);
         }
     }
     parent::destroy(get_class(), $page_id);
 }
开发者ID:homebru,项目名称:bandb,代码行数:20,代码来源:Page.php

示例7: delete

 /**
  * Function: delete
  * Deletes the given topic. Calls the "delete_topic" trigger and passes the <Topic> as an argument.
  *
  * Parameters:
  *     $id - The topic to delete.
  */
 static function delete($id)
 {
     $topic = new self($id);
     foreach ($topic->message as $message) {
         Message::delete($message->id);
     }
     parent::destroy(get_class(), $id);
     foreach ($topic->attachments as $attachment) {
         unlink(uploaded($attachment->path, false));
     }
     if (module_enabled("cacher")) {
         Modules::$instances["cacher"]->regenerate();
     }
 }
开发者ID:vito,项目名称:chyrp-site,代码行数:21,代码来源:Topic.php

示例8: create

 public static function create($params)
 {
     // Check if item is already in the list
     if (self::checkRecentItemPresent($params)) {
         return array();
     }
     // Add row to table
     $returnArray = parent::create($params);
     if (!isset($returnArray) || count($returnArray) < 1) {
         return $returnArray;
     }
     // Check if old row needs to be purged
     $itemCount = self::getRecentItemCount($params);
     if ($itemCount >= self::$maxItemsPerUser) {
         // Get oldest row for user
         $id = self::getOldestItem($params);
         // Delete oldest row for user
         $paramsT = array("data" => array(array("id" => $id)));
         parent::destroy($paramsT);
     }
     return $returnArray;
 }
开发者ID:ncowan15,项目名称:FoodApp3,代码行数:22,代码来源:recentItem.php

示例9: delete

 /**
  * Function: delete
  * Deletes a given user. Calls the @delete_user@ trigger and passes the <User> as an argument.
  *
  * Parameters:
  *     $id - The user to delete.
  */
 static function delete($id)
 {
     parent::destroy(get_class(), $id);
 }
开发者ID:vito,项目名称:chyrp-site,代码行数:11,代码来源:User.php

示例10: delete

 /**
  * Function: delete
  * Deletes the given extension, including its notes. Calls the "delete_extension" trigger and passes the <Extension> as an argument.
  *
  * Parameters:
  *     $id - The extension to delete.
  */
 static function delete($id)
 {
     $extension = new self($id);
     foreach ($extension->versions as $version) {
         Version::delete($version->id);
     }
     parent::destroy(get_class(), $id);
     if (module_enabled("cacher")) {
         Modules::$instances["cacher"]->regenerate();
     }
 }
开发者ID:vito,项目名称:chyrp-site,代码行数:18,代码来源:Extension.php

示例11: destroy

 function destroy()
 {
     foreach ($this->dsql as $k => $q) {
         unset($q);
     }
     foreach ($this->fields as $k => $f) {
         unset($this->fields[$k]);
     }
     return parent::destroy();
 }
开发者ID:xavoctechnocratspvtltd,项目名称:svc,代码行数:10,代码来源:MVCTable.php

示例12: delete

 /**
  * Function: delete
  * Deletes the given version, including its notes. Calls the "delete_version" trigger and passes the <Version> as an argument.
  *
  * Parameters:
  *     $id - The version to delete.
  */
 static function delete($id)
 {
     $version = new self($id);
     foreach ($version->notes as $note) {
         Note::delete($note->id);
     }
     foreach ($version->attachments as $attachment) {
         Attachment::delete($attachment->id);
     }
     @unlink(uploaded($version->filename, false));
     @unlink(uploaded($version->preview, false));
     parent::destroy(get_class(), $id);
     if (module_enabled("cacher")) {
         Modules::$instances["cacher"]->regenerate();
     }
 }
开发者ID:vito,项目名称:chyrp-site,代码行数:23,代码来源:Version.php

示例13: delete

 /**
  * @param $id
  *
  * @return int
  */
 public function delete($id)
 {
     return $this->model->destroy($id);
 }
开发者ID:damnyan,项目名称:laravel,代码行数:9,代码来源:AbstractRepository.php

示例14: delete

 /**
  * Function: delete
  * Deletes the given ticket, including its revisions and attachment. Calls the "delete_ticket" trigger and passes the <Ticket> as an argument.
  *
  * Parameters:
  *     $id - The ticket to delete.
  */
 static function delete($id)
 {
     $ticket = new self($id);
     foreach ($ticket->revisions as $revision) {
         Revision::delete($revision->id);
     }
     parent::destroy(get_class(), $id);
     foreach ($ticket->attachments as $attachment) {
         unlink(uploaded($attachment->path, false));
     }
     if (module_enabled("cacher")) {
         Modules::$instances["cacher"]->regenerate();
     }
 }
开发者ID:vito,项目名称:chyrp-site,代码行数:21,代码来源:Ticket.php


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