本文整理汇总了PHP中RedBeanPHP\R::trash方法的典型用法代码示例。如果您正苦于以下问题:PHP R::trash方法的具体用法?PHP R::trash怎么用?PHP R::trash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RedBeanPHP\R
的用法示例。
在下文中一共展示了R::trash方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
public function delete($id)
{
$item = R::findOne('ecatalog', 'id=?', [$id]);
R::trash($item);
@unlink('upload/' . $item['pdf_path']);
@unlink('upload/' . $item['cover_path']);
$this->slim->redirect($this->slim->request()->getRootUri() . '/ecatalog');
}
示例2: delete
public function delete($roomId, $id)
{
$item = R::findOne('room_pattern', 'id=?', [$id]);
@unlink('upload/' . $item->picture);
@unlink('upload/' . $item->thumb);
R::trash($item);
$this->slim->redirect($this->slim->request()->getRootUri() . '/room/' . $roomId . '/pattern');
}
示例3: trash
public function trash($bean)
{
if (is_string($bean) || is_numeric($bean)) {
return R::trash($this->type, $bean);
}
return R::trash($bean);
}
示例4: remove
public function remove()
{
$bean = R::findOne('group', ' name = ? ', [$this->name]);
if ($bean !== null) {
R::trash($bean);
return true;
}
return false;
}
示例5: deleteUser
public function deleteUser(Request $request, Response $response, array $args)
{
$name = $args['name'];
if (empty($name)) {
$this->flash->addMessage('flash', 'No user specified');
return $response->withRedirect($request->getUri()->getBaseUrl() . $this->router->pathFor('users'));
}
$user = R::findOne('users', ' email = ? ', [$name]);
if (!empty($user)) {
R::trash($user);
$this->flash->addMessage('flash', "{$name} deleted");
} else {
$this->flash->addMessage('flash', "{$name} User not found");
}
return $response->withRedirect($request->getUri()->getBaseUrl() . $this->router->pathFor('users'));
}
示例6: replace
public function replace()
{
$user = App::user();
$existingBeans = R::findAll('territory', ' number = :number ', ['number' => $this->number]);
foreach ($existingBeans as $bean) {
$copy = R::dispense('territoryedit');
$copy->geoJson = $bean->geoJson;
$copy->name = $bean->name;
$copy->number = $bean->number;
$copy->locality = $bean->locality;
$copy->congregation = $bean->congregation;
$copy->created = $bean->created;
$copy->createdBy = $bean->createdBy;
$copy->archived = time();
$copy->archivedBy = $user->id;
R::store($copy);
R::trash($bean);
}
$bean = R::dispense('territory');
$bean->geoJson = $this->geoJson;
$bean->name = $this->name;
$bean->number = $this->number;
$bean->locality = $this->locality;
$bean->congregation = $this->congregation;
$bean->created = time();
$bean->createdBy = $user->id;
R::store($bean);
$this->_bean = $bean;
return $this;
}
示例7: deleteBean
/**
* Delete the loaded bean
* @throws NoBeanException
*/
public function deleteBean()
{
if ($this->currentBean == null) {
throw new NoBeanException();
}
R::trash($this->currentBean);
}
示例8: removeLab
public function removeLab($id, $school_id = null)
{
$sql = ' id = ? ';
$bindings = [(int) $id];
if (null !== $school_id) {
$sql .= ' AND school_id = ? ';
$bindings[] = (int) $school_id;
}
$lab = R::findOne('lab', $sql, $bindings);
if (null !== $lab) {
if ($lab->attachment && is_writable($this->filesPath . '/' . $lab->attachment)) {
unlink($this->filesPath . '/' . $lab->attachment);
}
R::trash($lab);
}
}
示例9: removeTeacher
public function removeTeacher($id)
{
R::trash('teacher', $id);
}
示例10: delete
/**
* Delete bean from database
*/
public function delete()
{
R::trash($this->_bean);
}
示例11: delete
public function delete($id)
{
$item = R::findOne('employee', 'id=?', [$id]);
R::trash($item);
$this->slim->redirect($this->slim->request()->getRootUri() . '/employee');
}
示例12: deletePair
/**
* @param string $currencyFromCode
* @param string $currencyToCode
*
* @return array
*/
public static function deletePair($currencyFromCode, $currencyToCode)
{
$pair = self::getPairFromDb(self::checkCurrency($currencyFromCode), self::checkCurrency($currencyToCode));
RedBean::trash($pair);
return ['success' => true];
}
示例13: delete
/**
*
*/
public function delete()
{
R::trash($this->table);
}
示例14: deleteRota
public function deleteRota(Request $request, Response $response, array $args)
{
$name = $args['name'];
if (empty($name)) {
$this->flash->addMessage('flash', 'No rota specified');
return $response->withRedirect($this->router->pathFor('rotas'));
}
$rota = R::findOne('rotas', ' name = ? ', [$name]);
if (!empty($rota)) {
R::trash($rota);
R::wipe($name);
$this->flash->addMessage('flash', "{$name} deleted");
} else {
$this->flash->addMessage('flash', "{$name} Rota not found");
}
return $response->withRedirect($this->router->pathFor('rotas'));
}
示例15: deleteProduct
public function deleteProduct($productId)
{
$token = $this->slim->request->params('token');
if (empty($token)) {
header('Content-Type: application/json');
echo json_encode(['error' => 'REQUIRE_AUTHORIZE'], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
exit;
}
$account = R::findOne("account", "token = ?", [$token]);
if (!$account) {
header('Content-Type: application/json');
echo json_encode(['error' => 'AUTHORIZE_FAILED'], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
exit;
}
$item = R::findOne("account_product", "account_id=? AND product_id = ?", [$account['id'], $productId]);
if (!$item) {
header('Content-Type: application/json');
echo json_encode(['error' => 'ACCOUNT_PRODUCT_NOT_FOUND'], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
exit;
}
R::trash($item);
header('Content-Type: application/json');
echo json_encode(['success' => true], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
exit;
}