1
0
mirror of https://github.com/flarum/core.git synced 2025-10-18 10:16:09 +02:00

Use Laravel's class-based Str and Arr helpers

Starting with version 5.9, the global funtions will be deprecated.

* https://laravel-news.com/laravel-5-8-deprecates-string-and-array-helpers
* https://github.com/laravel/framework/pull/26898
This commit is contained in:
Franz Liedke
2019-07-06 00:49:34 +02:00
parent 307b912019
commit 646bd40bca
78 changed files with 229 additions and 144 deletions

View File

@@ -17,6 +17,7 @@ use Flarum\Discussion\Event\Saving;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\User\AssertPermissionTrait;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Support\Arr;
class EditDiscussionHandler
{
@@ -54,7 +55,7 @@ class EditDiscussionHandler
{
$actor = $command->actor;
$data = $command->data;
$attributes = array_get($data, 'attributes', []);
$attributes = Arr::get($data, 'attributes', []);
$discussion = $this->discussions->findOrFail($command->discussionId, $actor);

View File

@@ -20,6 +20,7 @@ use Flarum\Post\Command\PostReply;
use Flarum\User\AssertPermissionTrait;
use Illuminate\Contracts\Bus\Dispatcher as BusDispatcher;
use Illuminate\Contracts\Events\Dispatcher as EventDispatcher;
use Illuminate\Support\Arr;
class StartDiscussionHandler
{
@@ -66,7 +67,7 @@ class StartDiscussionHandler
// an opportunity to alter the discussion entity based on data in the
// command they may have passed through in the controller.
$discussion = Discussion::start(
array_get($data, 'attributes.title'),
Arr::get($data, 'attributes.title'),
$actor
);