Skip to content

Commit

Permalink
Fix PHPDocs
Browse files Browse the repository at this point in the history
  • Loading branch information
santigarcor committed Jun 9, 2017
1 parent 788ec43 commit 78874db
Show file tree
Hide file tree
Showing 23 changed files with 342 additions and 310 deletions.
10 changes: 5 additions & 5 deletions src/Laratrust/Contracts/LaratrustPermissionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@

interface LaratrustPermissionInterface
{

/**
* Many-to-Many relations with role model.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function roles();
/**
* Morph by Many relationship between the role and the one of the possible user models

/**
* Morph by Many relationship between the permission and the one of the possible user models.
*
* @param string $relationship
* @param string $relationship
* @return \Illuminate\Database\Eloquent\Relations\MorphToMany
*/
public function getMorphByUserRelation($relationship);
Expand Down
46 changes: 25 additions & 21 deletions src/Laratrust/Contracts/LaratrustRoleInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,61 +13,65 @@
interface LaratrustRoleInterface
{
/**
* Morph by Many relationship between the role and the one of the possible user models
* Morph by Many relationship between the role and the one of the possible user models.
*
* @param string $relationship
* @param string $relationship
* @return \Illuminate\Database\Eloquent\Relations\MorphToMany
*/
public function getMorphByUserRelation($relationship);

/**
* Many-to-Many relations with the permission model.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function permissions();

/**
* Save the inputted permissions.
* Checks if the role has a permission by its name.
*
* @param mixed $permissions
* @param string|array $permission Permission name or array of permission names.
* @param bool $requireAll All permissions in the array are required.
* @return bool
*/
public function hasPermission($permission, $requireAll);

/**
* Save the inputted permissions.
*
* @return void
* @param mixed $permissions
* @return array
*/
public function syncPermissions($permissions);
/**

/**
* Attach permission to current role.
*
* @param object|array $permission
*
* @param object|array $permission
* @return void
*/
public function attachPermission($permission);

/**
* Detach permission form current role.
*
* @param object|array $permission
* Detach permission from current role.
*
* @param object|array $permission
* @return void
*/
public function detachPermission($permission);

/**
* Attach multiple permissions to current role.
*
* @param mixed $permissions
*
* @param mixed $permissions
* @return void
*/
public function attachPermissions($permissions);

/**
* Detach multiple permissions from current role
*
* @param mixed $permissions
*
* @param mixed $permissions
* @return void
*/
public function detachPermissions($permissions);
Expand Down
5 changes: 2 additions & 3 deletions src/Laratrust/Contracts/LaratrustTeamInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@
interface LaratrustTeamInterface
{
/**
* Morph by Many relationship between the team
* and the one user by role models
* Morph by Many relationship between the role and the one of the possible user models.
*
* @param string $relationship
* @return Illuminate\Database\Eloquent\Relations\MorphToMany
* @return \Illuminate\Database\Eloquent\Relations\MorphToMany
*/
public function getMorphByUserRelation($relationship);
}
146 changes: 78 additions & 68 deletions src/Laratrust/Contracts/LaratrustUserInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface LaratrustUserInterface
public function roles();

/**
* Many-to-Many relations with Role.
* Many-to-Many relations with Permission.
*
* @return \Illuminate\Database\Eloquent\Relations\MorphToMany
*/
Expand All @@ -29,158 +29,168 @@ public function permissions();
/**
* Checks if the user has a role by its name.
*
* @param string|array $name Role name or array of role names.
* @param string|bool $team Team name or requiredAll roles.
* @param bool $requireAll All roles in the array are required.
*
* @param string|array $name Role name or array of role names.
* @param string|bool $team Team name or requiredAll roles.
* @param bool $requireAll All roles in the array are required.
* @return bool
*/
public function hasRole($name, $team = null, $requireAll = false);

/**
* Check if user has a permission by its name.
*
* @param string|array $permission Permission string or array of permissions.
* @param string|bool $team Team name or requiredAll roles.
* @param bool $requireAll All roles in the array are required.
*
* @param string|array $permission Permission string or array of permissions.
* @param string|bool $team Team name or requiredAll roles.
* @param bool $requireAll All roles in the array are required.
* @return bool
*/
public function hasPermission($permission, $team = null, $requireAll = false);

/**
* Check if user has a permission by its name. Calls hasPermission method
*
* @param string|array $permission Permission string or array of permissions.
* @param string|bool $team Team name or requiredAll roles.
* @param bool $requireAll All permissions in the array are required.
* Check if user has a permission by its name.
*
* @param string|array $permission Permission string or array of permissions.
* @param string|bool $team Team name or requiredAll roles.
* @param bool $requireAll All permissions in the array are required.
* @return bool
*/
public function can($permission, $team = null, $requireAll = false);

/**
* Check if user has a permission by its name. Calls hasPermission method
*
* @param string|array $permission Permission string or array of permissions.
* @param string|bool $team Team name or requiredAll roles.
* @param bool $requireAll All permissions in the array are required.
* Check if user has a permission by its name.
*
* @param string|array $permission Permission string or array of permissions.
* @param string|bool $team Team name or requiredAll roles.
* @param bool $requireAll All permissions in the array are required.
* @return bool
*/
public function isAbleTo($permission, $team = null, $requireAll = false);

/**
* Checks role(s) and permission(s).
*
* @param string|array $roles Array of roles or comma separated string
* @param string|array $permissions Array of permissions or comma separated string.
* @param string|bool $team Team name or requiredAll roles.
* @param array $options validate_all (true|false) or return_type (boolean|array|both)
*
* @param string|array $roles Array of roles or comma separated string
* @param string|array $permissions Array of permissions or comma separated string.
* @param string|bool $team Team name or requiredAll roles.
* @param array $options validate_all (true|false) or return_type (boolean|array|both)
* @throws \InvalidArgumentException
*
* @return array|bool
*/
public function ability($roles, $permissions, $team = null, $options = []);

/**
* Alias to eloquent many-to-many relation's attach() method.
*
* @param mixed $role
* @param mixed $team
* @param mixed $role
* @param mixed $team
* @return static
*/
public function attachRole($role, $team = null);

/**
* Alias to eloquent many-to-many relation's detach() method.
*
* @param mixed $role
* @param mixed $team
* @param mixed $role
* @param mixed $team
* @return static
*/
public function detachRole($role, $team = null);

/**
* Attach multiple roles to a user
* Attach multiple roles to a user.
*
* @param mixed $roles
* @param mixed $team
* @param mixed $roles
* @param mixed $team
* @return static
*/
public function attachRoles($roles = [], $team = null);

/**
* Detach multiple roles from a user
* Detach multiple roles from a user.
*
* @param mixed $roles
* @param mixed $team
* @param mixed $roles
* @param mixed $team
* @return static
*/
public function detachRoles($roles = [], $team = null);

/**
* Sync multiple roles in a user
* @param array $roles
* @param mixed $team
* Sync roles to the user.
*
* @param array $roles
* @param mixed $team
* @return static
*/
public function syncRoles($roles = [], $team = null);

/**
* Alias to eloquent many-to-many relation's attach() method.
*
* @param mixed $permission
* @param mixed $team
* @param mixed $permission
* @param mixed $team
* @return static
*/
public function attachPermission($permission, $team = null);

/**
* Alias to eloquent many-to-many relation's detach() method.
*
* @param mixed $permission
* @param mixed $team
* @param mixed $permission
* @param mixed $team
* @return static
*/
public function detachPermission($permission, $team = null);

/**
* Attach multiple permissions to a user
* Attach multiple permissions to a user.
*
* @param mixed $permissions
* @param mixed $team
* @param mixed $permissions
* @param mixed $team
* @return static
*/
public function attachPermissions($permissions = [], $team = null);

/**
* Detach multiple permissions from a user
* Detach multiple permissions from a user.
*
* @param mixed $permissions
* @param mixed $team
* @param mixed $permissions
* @param mixed $team
* @return static
*/
public function detachPermissions($permissions = [], $team = null);

/**
* Sync multiple roles in a user
* @param array $permissions
* @param mixed $team
* Sync roles to the user.
*
* @param array $permissions
* @return static
*/
public function syncPermissions($permissions = [], $team = null);

/**
* Checks if the user owns the thing
* @param mixed $thing
* Checks if the user owns the thing.
*
* @param Object $thing
* @param string $foreignKeyName
* @return boolean
*/
public function owns($thing);

/**
* Checks if the user can do something and if he owns the thing
* @param string|array $permission
* @param Object $thing
* Checks if the user has some role and if he owns the thing.
*
* @param string|array $role
* @param Object $thing
* @param array $options
* @return boolean
*/
public function hasRoleAndOwns($role, $thing, $options = []);

/**
* Checks if the user can do something and if he owns the thing
* @param string|array $permission
* @param Object $thing
* Checks if the user can do something and if he owns the thing.
*
* @param string|array $permission
* @param Object $thing
* @param array $options
* @return boolean
*/
Expand Down
3 changes: 2 additions & 1 deletion src/Laratrust/Contracts/Ownable.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
interface Ownable
{
/**
* Gets the owner key value inside the model or object
* Gets the owner key value inside the model or object.
*
* @return mixed
*/
public function ownerKey();
Expand Down

0 comments on commit 78874db

Please sign in to comment.