Skip to content

Commit

Permalink
use illuminate Str class
Browse files Browse the repository at this point in the history
  • Loading branch information
StApostol committed Dec 6, 2019
1 parent 78aeffe commit 6d11570
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
8 changes: 7 additions & 1 deletion src/Lfm.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Illuminate\Contracts\Config\Repository as Config;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Str;
use UniSharp\LaravelFilemanager\Middlewares\CreateDefaultFolder;
use UniSharp\LaravelFilemanager\Middlewares\MultiUser;

Expand Down Expand Up @@ -73,7 +74,7 @@ public function currentLfmType()
{
$lfm_type = 'file';

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

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

public function getPaginationPerPage()
{
return $this->config->get("lfm.paginator.perPage", 30);
}

/**
* Check if users are allowed to use their private folders.
*
Expand Down
5 changes: 3 additions & 2 deletions src/LfmItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace UniSharp\LaravelFilemanager;

use Symfony\Component\HttpFoundation\File\UploadedFile;
use Illuminate\Support\Str;

class LfmItem
{
Expand All @@ -21,7 +22,7 @@ public function __construct(LfmPath $lfm, Lfm $helper)
public function __get($var_name)
{
if (!array_key_exists($var_name, $this->attributes)) {
$function_name = camel_case($var_name);
$function_name = Str::camel($var_name);
$this->attributes[$var_name] = $this->$function_name();
}

Expand Down Expand Up @@ -66,7 +67,7 @@ public function isFile()
public function isImage()
{
if (!$this->isDirectory()) {
return starts_with($this->mimeType(), 'image');
return Str::startsWith($this->mimeType(), 'image');
}

return false;
Expand Down
5 changes: 3 additions & 2 deletions src/Middlewares/MultiUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace UniSharp\LaravelFilemanager\Middlewares;

use Closure;
use Illuminate\Support\Str;
use UniSharp\LaravelFilemanager\Lfm;

class MultiUser
Expand Down Expand Up @@ -32,11 +33,11 @@ public function handle($request, Closure $next)

private function validDir($previous_dir)
{
if (starts_with($previous_dir, $this->helper->getRootFolder('share'))) {
if (Str::startsWith($previous_dir, $this->helper->getRootFolder('share'))) {
return true;
}

if (starts_with($previous_dir, $this->helper->getRootFolder('user'))) {
if (Str::startsWith($previous_dir, $this->helper->getRootFolder('user'))) {
return true;
}

Expand Down

0 comments on commit 6d11570

Please sign in to comment.