Skip to content

Commit 4d6593e

Browse files
yajragithub-actions[bot]
authored andcommitted
fix: pint
1 parent 67ee20b commit 4d6593e

28 files changed

+46
-187
lines changed

migrations/2015_12_20_100001_create_permissions_table.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
use Illuminate\Database\Schema\Blueprint;
55
use Illuminate\Support\Facades\Schema;
66

7-
return new class extends Migration {
7+
return new class extends Migration
8+
{
89
/**
910
* Run the migrations.
10-
*
11-
* @return void
1211
*/
1312
public function up(): void
1413
{
@@ -24,8 +23,6 @@ public function up(): void
2423

2524
/**
2625
* Reverse the migration.
27-
*
28-
* @return void
2926
*/
3027
public function down(): void
3128
{

migrations/2015_12_20_100002_create_roles_table.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
use Illuminate\Database\Schema\Blueprint;
55
use Illuminate\Support\Facades\Schema;
66

7-
return new class extends Migration {
7+
return new class extends Migration
8+
{
89
/**
910
* Run the migrations.
10-
*
11-
* @return void
1211
*/
1312
public function up(): void
1413
{
@@ -24,8 +23,6 @@ public function up(): void
2423

2524
/**
2625
* Reverse the migration.
27-
*
28-
* @return void
2926
*/
3027
public function down(): void
3128
{

migrations/2015_12_20_100003_create_permission_role_table.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
use Illuminate\Database\Schema\Blueprint;
55
use Illuminate\Support\Facades\Schema;
66

7-
return new class extends Migration {
7+
return new class extends Migration
8+
{
89
/**
910
* Run the migrations.
10-
*
11-
* @return void
1211
*/
1312
public function up(): void
1413
{
@@ -22,8 +21,6 @@ public function up(): void
2221

2322
/**
2423
* Reverse the migration.
25-
*
26-
* @return void
2724
*/
2825
public function down(): void
2926
{

migrations/2015_12_20_100004_create_role_user_table.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
use Illuminate\Database\Schema\Blueprint;
55
use Illuminate\Support\Facades\Schema;
66

7-
return new class extends Migration {
7+
return new class extends Migration
8+
{
89
/**
910
* Run the migrations.
10-
*
11-
* @return void
1211
*/
1312
public function up(): void
1413
{
@@ -22,8 +21,6 @@ public function up(): void
2221

2322
/**
2423
* Reverse the migration.
25-
*
26-
* @return void
2724
*/
2825
public function down(): void
2926
{

migrations/2015_12_20_100005_create_permission_user_table.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
use Illuminate\Database\Schema\Blueprint;
55
use Illuminate\Support\Facades\Schema;
66

7-
return new class extends Migration {
7+
return new class extends Migration
8+
{
89
/**
910
* Run the migrations.
10-
*
11-
* @return void
1211
*/
1312
public function up(): void
1413
{
@@ -22,8 +21,6 @@ public function up(): void
2221

2322
/**
2423
* Reverse the migrations.
25-
*
26-
* @return void
2724
*/
2825
public function down(): void
2926
{

src/AclServiceProvider.php

-9
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ class AclServiceProvider extends ServiceProvider
99
{
1010
/**
1111
* Register any application authentication / authorization services.
12-
*
13-
* @param GateRegistrar $gate
14-
* @return void
1512
*/
1613
public function boot(GateRegistrar $gate): void
1714
{
@@ -25,8 +22,6 @@ public function boot(GateRegistrar $gate): void
2522

2623
/**
2724
* Publish package config file.
28-
*
29-
* @return void
3025
*/
3126
protected function publishConfig(): void
3227
{
@@ -39,8 +34,6 @@ protected function publishConfig(): void
3934

4035
/**
4136
* Publish package migration files.
42-
*
43-
* @return void
4437
*/
4538
protected function publishMigrations(): void
4639
{
@@ -52,8 +45,6 @@ protected function publishMigrations(): void
5245

5346
/**
5447
* Register custom blade directives.
55-
*
56-
* @return void
5748
*/
5849
protected function registerBladeDirectives(): void
5950
{

src/Directives/CanAtLeastDirective.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class CanAtLeastDirective extends DirectiveAbstract
1010
* Can at least blade directive compiler.
1111
*
1212
* @param string|array $permissions
13-
* @return bool
13+
*
1414
* @throws \Exception
1515
* @throws \Throwable
1616
*/

src/Directives/DirectiveAbstract.php

-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ abstract class DirectiveAbstract
1313

1414
/**
1515
* IsRoleDirective constructor.
16-
*
17-
* @param \Illuminate\Contracts\Auth\Guard $auth
1816
*/
1917
public function __construct(Guard $auth)
2018
{

src/Directives/RoleDirective.php

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ class RoleDirective extends DirectiveAbstract
88
* Is Role blade directive compiler.
99
*
1010
* @param string|array $role
11-
* @return bool
1211
*/
1312
public function handle($role): bool
1413
{

src/GateRegistrar.php

-8
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ class GateRegistrar
1313
{
1414
/**
1515
* GateRegistrar constructor.
16-
*
17-
* @param GateContract $gate
18-
* @param Repository $cache
1916
*/
2017
public function __construct(public GateContract $gate, public Repository $cache)
2118
{
@@ -45,8 +42,6 @@ public function register(): void
4542

4643
/**
4744
* Get all permissions.
48-
*
49-
* @return Collection
5045
*/
5146
protected function getPermissions(): Collection
5247
{
@@ -69,9 +64,6 @@ protected function getPermissions(): Collection
6964
}
7065
}
7166

72-
/**
73-
* @return Permission
74-
*/
7567
protected function getPermissionClass(): Permission
7668
{
7769
/** @var class-string $class */

src/Middleware/CanAtLeastMiddleware.php

-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ class CanAtLeastMiddleware
1010
/**
1111
* Handle an incoming request.
1212
*
13-
* @param \Illuminate\Http\Request $request
14-
* @param \Closure $next
1513
* @param array|string $permissions
1614
* @return mixed
1715
*/

src/Middleware/PermissionMiddleware.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,11 @@ class PermissionMiddleware
1010
/**
1111
* Handle an incoming request.
1212
*
13-
* @param \Illuminate\Http\Request $request
14-
* @param \Closure $next
15-
* @param string $permission
1613
* @return mixed
1714
*/
1815
public function handle(Request $request, Closure $next, string $permission)
1916
{
20-
if (!auth()->user() || !auth()->user()->can($permission)) {
17+
if (! auth()->user() || ! auth()->user()->can($permission)) {
2118
if ($request->ajax()) {
2219
return response()->json([
2320
'error' => [

src/Middleware/RoleMiddleware.php

-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ class RoleMiddleware
1111
/**
1212
* Handle an incoming request.
1313
*
14-
* @param \Illuminate\Http\Request $request
15-
* @param \Closure $next
16-
* @param string $role
1714
* @return mixed
1815
*/
1916
public function handle(Request $request, Closure $next, string $role)

src/Models/Permission.php

+1-7
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ class Permission extends Model
3232
/**
3333
* Find a permission by slug.
3434
*
35-
* @param string $slug
3635
* @return \Illuminate\Database\Eloquent\Model|static
36+
*
3737
* @throws \Illuminate\Database\Eloquent\ModelNotFoundException<\Illuminate\Database\Eloquent\Model>
3838
*/
3939
public static function findBySlug(string $slug)
@@ -43,10 +43,6 @@ public static function findBySlug(string $slug)
4343

4444
/**
4545
* Create a permissions for a resource.
46-
*
47-
* @param string $resource
48-
* @param bool $system
49-
* @return \Illuminate\Database\Eloquent\Collection
5046
*/
5147
public static function createResource(string $resource, bool $system = false): Collection
5248
{
@@ -99,8 +95,6 @@ public static function createResource(string $resource, bool $system = false): C
9995

10096
/**
10197
* Permission can belong to many users.
102-
*
103-
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
10498
*/
10599
public function users(): BelongsToMany
106100
{

src/Models/Role.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ class Role extends Model
3131
/**
3232
* Find a role by slug.
3333
*
34-
* @param string $slug
3534
* @return \Illuminate\Database\Eloquent\Model|static
35+
*
3636
* @throws \Illuminate\Database\Eloquent\ModelNotFoundException
3737
*/
3838
public static function findBySlug(string $slug)
@@ -42,8 +42,6 @@ public static function findBySlug(string $slug)
4242

4343
/**
4444
* Roles can belong to many users.
45-
*
46-
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
4745
*/
4846
public function users(): BelongsToMany
4947
{

src/Traits/AuthorizesPermissionResources.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ trait AuthorizesPermissionResources
2828
/**
2929
* Authorize a permission resource action based on the incoming request.
3030
*
31-
* @param string $resource
32-
* @param array $options
3331
* @return void
3432
*/
3533
public function authorizePermissionResource(string $resource, array $options = [])
@@ -43,16 +41,14 @@ public function authorizePermissionResource(string $resource, array $options = [
4341
]));
4442
}
4543

46-
$collection->groupBy('ability')->each(function ($permission, $ability) use ($resource, $options) {
44+
$collection->groupBy('ability')->each(function ($permission, $ability) use ($resource) {
4745
$this->middleware("can:{$resource}.{$ability}")
4846
->only($permission->pluck('method')->toArray());
4947
});
5048
}
5149

5250
/**
5351
* Get the map of permission resource methods to ability names.
54-
*
55-
* @return array
5652
*/
5753
protected function resourcePermissionMap(): array
5854
{

src/Traits/HasPermission.php

-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Yajra\Acl\Traits;
44

5-
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
65
use Yajra\Acl\Models\Permission;
76

87
trait HasPermission
@@ -13,7 +12,6 @@ trait HasPermission
1312
* Checks if the role has the given permission.
1413
*
1514
* @param array|string $permission
16-
* @return bool
1715
*/
1816
public function can($permission): bool
1917
{
@@ -34,7 +32,6 @@ public function can($permission): bool
3432
* Checks if the role does not have the given permission.
3533
*
3634
* @param array|string $permission
37-
* @return bool
3835
*/
3936
public function cannot($permission): bool
4037
{
@@ -45,7 +42,6 @@ public function cannot($permission): bool
4542
* Check if the role has at least one of the given permissions.
4643
*
4744
* @param string|array $permission
48-
* @return bool
4945
*/
5046
public function canAtLeast($permission): bool
5147
{

src/Traits/HasRole.php

-7
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ trait HasRole
1414
* Check if user have access using any of the acl (permissions or roles slug).
1515
*
1616
* @param string|array $acl
17-
* @return boolean
1817
*/
1918
public function canAccess($acl): bool
2019
{
@@ -25,7 +24,6 @@ public function canAccess($acl): bool
2524
* Check if user has at least one of the given permissions
2625
*
2726
* @param string|array $permissions
28-
* @return bool
2927
*/
3028
public function canAtLeast($permissions): bool
3129
{
@@ -51,11 +49,8 @@ public function canAtLeast($permissions): bool
5149
return $can;
5250
}
5351

54-
5552
/**
5653
* Get all user role permissions.
57-
*
58-
* @return array
5954
*/
6055
public function getPermissions(): array
6156
{
@@ -71,9 +66,7 @@ public function getPermissions(): array
7166
/**
7267
* Check if the given entity/model is owned by the user.
7368
*
74-
* @param \Illuminate\Database\Eloquent\Model $entity
7569
* @param string $relation
76-
* @return bool
7770
*/
7871
public function owns(Model $entity, $relation = 'user_id'): bool
7972
{

0 commit comments

Comments
 (0)