Skip to content

Commit 1495819

Browse files
committed
Closing v5.3.4
1 parent af97e82 commit 1495819

File tree

5 files changed

+24
-18
lines changed

5 files changed

+24
-18
lines changed

app/Services/MenuService.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace App\Services;
44

5+
use Illuminate\Support\Facades\Gate;
56
use TorMorten\Eventy\Facades\Eventy as Hook;
67

78
class MenuService
@@ -479,7 +480,15 @@ public function getMenus()
479480
$this->menus = Hook::filter( 'ns-dashboard-menus', $this->menus );
480481
$this->toggleActive();
481482

482-
return $this->menus;
483+
return collect( $this->menus )->filter( function( $menu ) {
484+
return ! isset( $menu[ 'permissions' ] ) || Gate::any( $menu[ 'permissions' ] );
485+
})->map( function( $menu ) {
486+
$menu[ 'childrens' ] = collect( $menu[ 'childrens' ] ?? [] )->filter( function( $submenu ) {
487+
return ! isset( $submenu[ 'permissions' ] ) || Gate::any( $submenu[ 'permissions' ] );
488+
})->toArray();
489+
490+
return $menu;
491+
});
483492
}
484493

485494
/**

config/sanctum.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
|
1616
*/
1717

18-
'stateful' => explode( ',', env( 'SANCTUM_STATEFUL_DOMAINS', sprintf(
18+
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
1919
'%s%s',
2020
'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
2121
Sanctum::currentApplicationUrlWithPort()
22-
) ) ),
22+
))),
2323

2424
/*
2525
|--------------------------------------------------------------------------
@@ -61,7 +61,7 @@
6161
|
6262
*/
6363

64-
'token_prefix' => env( 'SANCTUM_TOKEN_PREFIX', '' ),
64+
'token_prefix' => env('SANCTUM_TOKEN_PREFIX', ''),
6565

6666
/*
6767
|--------------------------------------------------------------------------

database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,23 @@
1111
*/
1212
public function up(): void
1313
{
14-
Schema::create( 'personal_access_tokens', function ( Blueprint $table ) {
14+
Schema::create('personal_access_tokens', function (Blueprint $table) {
1515
$table->id();
16-
$table->morphs( 'tokenable' );
17-
$table->string( 'name' );
18-
$table->string( 'token', 64 )->unique();
19-
$table->text( 'abilities' )->nullable();
20-
$table->timestamp( 'last_used_at' )->nullable();
21-
$table->timestamp( 'expires_at' )->nullable();
16+
$table->morphs('tokenable');
17+
$table->string('name');
18+
$table->string('token', 64)->unique();
19+
$table->text('abilities')->nullable();
20+
$table->timestamp('last_used_at')->nullable();
21+
$table->timestamp('expires_at')->nullable();
2222
$table->timestamps();
23-
} );
23+
});
2424
}
2525

2626
/**
2727
* Reverse the migrations.
2828
*/
2929
public function down(): void
3030
{
31-
Schema::dropIfExists( 'personal_access_tokens' );
31+
Schema::dropIfExists('personal_access_tokens');
3232
}
3333
};

resources/views/layout/dashboard.blade.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,17 +118,13 @@
118118
</div>
119119
<ul>
120120
@foreach( $menus->getMenus() as $identifier => $menu )
121-
@if ( isset( $menu[ 'permissions' ] ) && Gate::allows( $menu[ 'permissions' ], 'some' ) || ! isset( $menu[ 'permissions' ] ) )
122121
<ns-menu identifier="{{ $identifier }}" toggled="{{ $menu[ 'toggled' ] ?? '' }}" label="{{ @$menu[ 'label' ] }}" icon="{{ @$menu[ 'icon' ] }}" href="{{ @$menu[ 'href' ] }}" notification="{{ isset( $menu[ 'notification' ] ) ? $menu[ 'notification' ] : 0 }}" id="menu-{{ $identifier }}">
123122
@if ( isset( $menu[ 'childrens' ] ) )
124123
@foreach( $menu[ 'childrens' ] as $identifier => $menu )
125-
@if ( isset( $menu[ 'permissions' ] ) && Gate::allows( $menu[ 'permissions' ], 'some' ) || ! isset( $menu[ 'permissions' ] ) )
126124
<ns-submenu :active="{{ ( isset( $menu[ 'active' ] ) ? ( $menu[ 'active' ] ? 'true' : 'false' ) : 'false' ) }}" href="{{ $menu[ 'href' ] }}" id="submenu-{{ $identifier }}">{{ $menu[ 'label' ] }}</ns-submenu>
127-
@endif
128125
@endforeach
129126
@endif
130127
</ns-menu>
131-
@endif
132128
@endforeach
133129
</ul>
134130
</div>

tests/Feature/UploadModuleTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ public function test_module_system()
8282
* Step 6: We'll reupload the module
8383
*/
8484
$response = $this->withSession( $this->app[ 'session' ]->all() )
85-
->json( 'POST', '/api/modules', [
85+
->withHeader( 'Accept', 'text/html' )
86+
->post( '/api/modules', [
8687
'module' => UploadedFile::fake()->createWithContent( 'module.zip', file_get_contents( $result[ 'path' ] ) ),
8788
] );
8889

0 commit comments

Comments
 (0)