本文整理汇总了PHP中app\Post::getDeleteDescriptor方法的典型用法代码示例。如果您正苦于以下问题:PHP Post::getDeleteDescriptor方法的具体用法?PHP Post::getDeleteDescriptor怎么用?PHP Post::getDeleteDescriptor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Post
的用法示例。
在下文中一共展示了Post::getDeleteDescriptor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetDeleteDescriptor
public function testGetDeleteDescriptor()
{
self::assertInstanceOf('Idealogica\\Lavanda\\Descriptor\\Descriptor', Post::getDeleteDescriptor());
self::assertCount(2, Post::getDeleteDescriptor());
}
示例2: testDeleteWithRelations
public function testDeleteWithRelations()
{
// one-to-many, many-to-many
App\Post::find(1)->deleteWithRelations();
self::assertEquals(App\Post::where('id', 1)->count(), 0);
self::assertEquals(App\Comment::where('post_id', 1)->count(), 0);
self::assertEquals(DB::table('lv_post_tag')->where('post_id', 1)->count(), 0);
// one-to-one
App\Post::getDeleteDescriptor()->removeDescription('comments');
App\Comment::getDeleteDescriptor()->add('post');
App\Comment::find(4)->deleteWithRelations();
self::assertEquals(App\Comment::where('id', 4)->count(), 0);
self::assertEquals(App\Post::where('id', 2)->count(), 0);
// db rollback
$this->rollback();
}