Skip to content

Commit 5e382b9

Browse files
authored
Merge pull request #827 from lloricode/patch-1
Fix deprecated helper functions, then add support for laravel 6
2 parents 78aeffe + 65cc4b1 commit 5e382b9

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "unisharp/laravel-filemanager",
3-
"description": "A file upload/editor intended for use with Laravel 6 and CKEditor / TinyMCE",
3+
"description": "A file upload/editor intended for use with Laravel 5 to 6 and CKEditor / TinyMCE",
44
"license": "MIT",
55
"keywords": [
66
"filemanager",
@@ -27,11 +27,11 @@
2727
"ext-exif": "*",
2828
"ext-fileinfo": "*",
2929
"intervention/image": "2.*",
30-
"illuminate/config": "5.4.* || 5.5.* || 5.6.* || 5.7.* || 5.8.* || 6.*.*",
31-
"illuminate/filesystem": "5.4.* || 5.5.* || 5.6.* || 5.7.* || 5.8.* || 6.*.*",
32-
"illuminate/support": "5.4.* || 5.5.* || 5.6.* || 5.7.* || 5.8.* || 6.*.*",
33-
"illuminate/http": "5.4.* || 5.5.* || 5.6.* || 5.7.* || 5.8.* || 6.*.*",
34-
"illuminate/container": "5.4.* || 5.5.* || 5.6.* || 5.7.* || 5.8.* || 6.*.*"
30+
"illuminate/config": "5.4.* || 5.5.* || 5.6.* || 5.7.* || 5.8.* || ^6.0",
31+
"illuminate/filesystem": "5.4.* || 5.5.* || 5.6.* || 5.7.* || 5.8.* || ^6.0",
32+
"illuminate/support": "5.4.* || 5.5.* || 5.6.* || 5.7.* || 5.8.* || ^6.0",
33+
"illuminate/http": "5.4.* || 5.5.* || 5.6.* || 5.7.* || 5.8.* || ^6.0",
34+
"illuminate/container": "5.4.* || 5.5.* || 5.6.* || 5.7.* || 5.8.* || ^6.0"
3535
},
3636
"require-dev": {
3737
"phpunit/phpunit": "^6.2",

src/Lfm.php

Lines changed: 2 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)) {

src/LfmItem.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace UniSharp\LaravelFilemanager;
44

5+
use Illuminate\Support\Str;
56
use Symfony\Component\HttpFoundation\File\UploadedFile;
67

78
class LfmItem
@@ -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)