Skip to content

Commit 6d11570

Browse files
committed
use illuminate Str class
1 parent 78aeffe commit 6d11570

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

src/Lfm.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Illuminate\Contracts\Config\Repository as Config;
66
use Illuminate\Http\Request;
77
use Illuminate\Support\Facades\Route;
8+
use Illuminate\Support\Str;
89
use UniSharp\LaravelFilemanager\Middlewares\CreateDefaultFolder;
910
use UniSharp\LaravelFilemanager\Middlewares\MultiUser;
1011

@@ -73,7 +74,7 @@ public function currentLfmType()
7374
{
7475
$lfm_type = 'file';
7576

76-
$request_type = lcfirst(str_singular($this->input('type') ?: ''));
77+
$request_type = lcfirst(Str::singular($this->input('type') ?: ''));
7778
$available_types = array_keys($this->config->get('lfm.folder_categories') ?: []);
7879

7980
if (in_array($request_type, $available_types)) {
@@ -157,6 +158,11 @@ public function maxUploadSize()
157158
return $this->config->get('lfm.folder_categories.' . $this->currentLfmType() . '.max_size');
158159
}
159160

161+
public function getPaginationPerPage()
162+
{
163+
return $this->config->get("lfm.paginator.perPage", 30);
164+
}
165+
160166
/**
161167
* Check if users are allowed to use their private folders.
162168
*

src/LfmItem.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace UniSharp\LaravelFilemanager;
44

55
use Symfony\Component\HttpFoundation\File\UploadedFile;
6+
use Illuminate\Support\Str;
67

78
class LfmItem
89
{
@@ -21,7 +22,7 @@ public function __construct(LfmPath $lfm, Lfm $helper)
2122
public function __get($var_name)
2223
{
2324
if (!array_key_exists($var_name, $this->attributes)) {
24-
$function_name = camel_case($var_name);
25+
$function_name = Str::camel($var_name);
2526
$this->attributes[$var_name] = $this->$function_name();
2627
}
2728

@@ -66,7 +67,7 @@ public function isFile()
6667
public function isImage()
6768
{
6869
if (!$this->isDirectory()) {
69-
return starts_with($this->mimeType(), 'image');
70+
return Str::startsWith($this->mimeType(), 'image');
7071
}
7172

7273
return false;

src/Middlewares/MultiUser.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace UniSharp\LaravelFilemanager\Middlewares;
44

55
use Closure;
6+
use Illuminate\Support\Str;
67
use UniSharp\LaravelFilemanager\Lfm;
78

89
class MultiUser
@@ -32,11 +33,11 @@ public function handle($request, Closure $next)
3233

3334
private function validDir($previous_dir)
3435
{
35-
if (starts_with($previous_dir, $this->helper->getRootFolder('share'))) {
36+
if (Str::startsWith($previous_dir, $this->helper->getRootFolder('share'))) {
3637
return true;
3738
}
3839

39-
if (starts_with($previous_dir, $this->helper->getRootFolder('user'))) {
40+
if (Str::startsWith($previous_dir, $this->helper->getRootFolder('user'))) {
4041
return true;
4142
}
4243

0 commit comments

Comments
 (0)