From 91b543879f67fcf4090b8809d71a098ea81d218f Mon Sep 17 00:00:00 2001 From: Lucas Michot Date: Tue, 29 Aug 2017 19:12:01 +0200 Subject: [PATCH] Use Arr and Str classes. --- src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php | 3 ++- src/Illuminate/Foundation/Console/TestMakeCommand.php | 3 ++- src/Illuminate/Foundation/helpers.php | 5 +++-- src/Illuminate/Http/Resources/Json/Resource.php | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php b/src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php index 13d3d9cd1ae4..7a13d37cfa67 100644 --- a/src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php +++ b/src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php @@ -2,6 +2,7 @@ namespace Illuminate\Foundation\Auth\Access; +use Illuminate\Support\Str; use Illuminate\Contracts\Auth\Access\Gate; trait AuthorizesRequests @@ -81,7 +82,7 @@ protected function normalizeGuessedAbilityName($ability) */ public function authorizeResource($model, $parameter = null, array $options = [], $request = null) { - $parameter = $parameter ?: snake_case(lcfirst(class_basename($model))); + $parameter = $parameter ?: Str::snake(lcfirst(class_basename($model))); $middleware = []; diff --git a/src/Illuminate/Foundation/Console/TestMakeCommand.php b/src/Illuminate/Foundation/Console/TestMakeCommand.php index 3c63323043fc..15b8cdf85368 100644 --- a/src/Illuminate/Foundation/Console/TestMakeCommand.php +++ b/src/Illuminate/Foundation/Console/TestMakeCommand.php @@ -2,6 +2,7 @@ namespace Illuminate\Foundation\Console; +use Illuminate\Support\Str; use Illuminate\Console\GeneratorCommand; class TestMakeCommand extends GeneratorCommand @@ -49,7 +50,7 @@ protected function getStub() */ protected function getPath($name) { - $name = str_replace_first($this->rootNamespace(), '', $name); + $name = Str::replaceFirst($this->rootNamespace(), '', $name); return $this->laravel->basePath().'/tests'.str_replace('\\', '/', $name).'.php'; } diff --git a/src/Illuminate/Foundation/helpers.php b/src/Illuminate/Foundation/helpers.php index 496bcdff9864..9589a1f63de6 100644 --- a/src/Illuminate/Foundation/helpers.php +++ b/src/Illuminate/Foundation/helpers.php @@ -1,5 +1,6 @@ resource->toArray(), $attributes) + Arr::only($this->resource->toArray(), $attributes) ); }