本文整理汇总了PHP中Illuminate\Database\Capsule\Manager::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Manager::delete方法的具体用法?PHP Manager::delete怎么用?PHP Manager::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Database\Capsule\Manager
的用法示例。
在下文中一共展示了Manager::delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setBonusAttribute
public function setBonusAttribute($value)
{
DB::delete('delete from t_event_bonuses where event_id = ? and player_id = ?', [$this->event->id, $this->player->id]);
if ($value && $value != 'null') {
DB::insert('insert into t_event_bonuses (event_id, player_id, bonus_id) values (?, ?, ?)', [$this->event->id, $this->player->id, $value]);
}
}
示例2: testRawQueries
public function testRawQueries()
{
// Insert
$inserted = Capsule::insert('INSERT INTO articles (title) VALUES (:title)', ['title' => static::ARTICLE_TITLE]);
$this->assertTrue($inserted);
// Last Insert ID
$id = Capsule::connection()->getPdo()->lastInsertId();
$this->assertEquals(1, $id);
// Select
$articles = Capsule::select('SELECT * FROM articles WHERE id = ?', [$id]);
$this->assertCount(1, $articles);
$this->assertEquals($articles[0]->title, static::ARTICLE_TITLE);
// Delete
$deleted = Capsule::delete('DELETE FROM articles WHERE id = ?', [$id]);
$this->assertEquals(1, $deleted);
// Count
$count = Capsule::selectOne('SELECT COUNT(*) as nb FROM articles');
$this->assertEquals(0, $count->nb);
}
示例3: join
/**
* Join guild
*
* @return void
*/
public function join(Character $player, $gid)
{
Capsule::delete('DELETE FROM `guild_invites` WHERE `player_id` = ?', [$player->id]);
$rank = app('capsule')->table('guild_ranks')->where(function ($query) use($gid) {
$query->where('guild_id', $gid);
$query->where('level', 1);
})->first();
$new_member = new GuildMember();
$new_member->player_id = $player->id;
$new_member->guild_id = $gid;
$new_member->rank_id = $rank->id;
$new_member->nick = '';
$new_member->save();
}