mirror of
https://github.com/flarum/core.git
synced 2025-10-14 00:15:51 +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:
@@ -18,6 +18,7 @@ use Flarum\Post\PostRepository;
|
||||
use Flarum\Post\PostValidator;
|
||||
use Flarum\User\AssertPermissionTrait;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class EditPostHandler
|
||||
{
|
||||
@@ -59,7 +60,7 @@ class EditPostHandler
|
||||
$post = $this->posts->findOrFail($command->postId, $actor);
|
||||
|
||||
if ($post instanceof CommentPost) {
|
||||
$attributes = array_get($data, 'attributes', []);
|
||||
$attributes = Arr::get($data, 'attributes', []);
|
||||
|
||||
if (isset($attributes['content'])) {
|
||||
$this->assertCan($actor, 'edit', $post);
|
||||
|
@@ -20,6 +20,7 @@ use Flarum\Post\Event\Saving;
|
||||
use Flarum\Post\PostValidator;
|
||||
use Flarum\User\AssertPermissionTrait;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class PostReplyHandler
|
||||
{
|
||||
@@ -86,12 +87,12 @@ class PostReplyHandler
|
||||
// opportunity to alter the post entity based on data in the command.
|
||||
$post = CommentPost::reply(
|
||||
$discussion->id,
|
||||
array_get($command->data, 'attributes.content'),
|
||||
Arr::get($command->data, 'attributes.content'),
|
||||
$actor->id,
|
||||
$command->ipAddress
|
||||
);
|
||||
|
||||
if ($actor->isAdmin() && ($time = array_get($command->data, 'attributes.createdAt'))) {
|
||||
if ($actor->isAdmin() && ($time = Arr::get($command->data, 'attributes.createdAt'))) {
|
||||
$post->created_at = new Carbon($time);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user