Skip to content

Commit a774800

Browse files
committed
Add custom config handler
1 parent 19e888b commit a774800

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace App\Handlers;
4+
5+
class ConfigHandler
6+
{
7+
public function userField()
8+
{
9+
return auth()->user()->id;
10+
}
11+
}

src/Handlers/ConfigHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace App\Handlers;
3+
namespace Unisharp\Laravelfilemanager\Handlers;
44

55
class ConfigHandler
66
{

src/LaravelFilemanagerServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function boot()
3737
], 'lfm_view');
3838

3939
$this->publishes([
40-
__DIR__.'/Handlers' => base_path('app/Handlers')
40+
__DIR__.'/CustomHandlers' => base_path('app/Handlers')
4141
], 'lfm_handler');
4242
}
4343

src/config/lfm.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@
3333
'allow_share_folder' => true,
3434

3535
// Flexibla way to customize client folders accessibility
36-
// You can extend ConfigHandler class and rewrite userField function in class
36+
// If you want to customize client folders, publish tag="lfm_handler"
37+
// Then you can rewrite userField function in App\Handler\ConfigHander class
38+
// And set 'user_field' to App\Handler\ConfigHander::class
3739
// Ex: The private folder of user will be named as the user id.
38-
'user_field' => App\Handlers\ConfigHandler::class,
40+
'user_field' => Unisharp\Laravelfilemanager\Handlers\ConfigHandler::class,
3941

4042
/*
4143
|--------------------------------------------------------------------------

0 commit comments

Comments
 (0)