desatir7316
شنبه 26 مهر 1393, 21:24 عصر
دوستان جرا توی این کد از $this استفاده نشده
$createPost = $auth->createPermission('createPost');
$createPost->description = 'Create a post';
$auth->add($createPost);
لینک (http://www.yiiframework.com/doc-2.0/guide-security-authorization.html#building-authorization-data)
ولی یه کم پایینتر توی همون صفحه که اومده کد رو کامل تر کنه از $this استفاده کرده
فرقی داره؟
$updateOwnPost = $this->auth->createPermission('updateOwnPost');
$updateOwnPost->description = 'Update own post';
$updateOwnPost->ruleName = $rule->name;
$auth->add($updateOwnPost);
لینک (http://www.yiiframework.com/doc-2.0/guide-security-authorization.html#using-rules)
$createPost = $auth->createPermission('createPost');
$createPost->description = 'Create a post';
$auth->add($createPost);
لینک (http://www.yiiframework.com/doc-2.0/guide-security-authorization.html#building-authorization-data)
ولی یه کم پایینتر توی همون صفحه که اومده کد رو کامل تر کنه از $this استفاده کرده
فرقی داره؟
$updateOwnPost = $this->auth->createPermission('updateOwnPost');
$updateOwnPost->description = 'Update own post';
$updateOwnPost->ruleName = $rule->name;
$auth->add($updateOwnPost);
لینک (http://www.yiiframework.com/doc-2.0/guide-security-authorization.html#using-rules)