Shift deprecated helpers

Laravel recommends using the `Str` and `Arr` class methods directly instead of the respective helper functions. These helper functions are [deprecated in Laravel 5.8][1] and will be removed in a future version.

[1]: https://github.com/laravel/framework/pull/26898
This commit is contained in:
Laravel Shift 2021-02-14 18:01:29 +00:00
parent 45c2af5dac
commit bf34794087
3 changed files with 8 additions and 6 deletions

View file

@ -2,6 +2,7 @@
namespace App\Http\Controllers\Api\Web;
use Illuminate\Support\Arr;
use App\Http\Controllers\Controller;
use App\Models\AlexaSession;
use App\Models\Track;
@ -146,7 +147,7 @@ class AlexaController extends Controller
public function play()
{
$track = array_first(Track::popular(1));
$track = Arr::first(Track::popular(1));
$this->session->put('current_position', 1);
$this->session->put('track_id', $track['id']);

View file

@ -20,6 +20,7 @@
namespace App\Http\Controllers\Api\Web;
use Illuminate\Support\Str;
use App\Http\Controllers\ApiControllerBase;
use App\Models\ResourceLogItem;
use App\Models\Track;
@ -87,12 +88,12 @@ class StatsController extends ApiControllerBase
foreach ($playsArray as $timeOffet => $plays) {
if ($hourly) {
$set = [
'hours' => $timeOffet.' '.str_plural('hour', $timeOffet),
'hours' => $timeOffet.' '.Str::plural('hour', $timeOffet),
'plays' => $plays,
];
} else {
$set = [
'days' => $timeOffet.' '.str_plural('day', $timeOffet),
'days' => $timeOffet.' '.Str::plural('day', $timeOffet),
'plays' => $plays,
];
}

View file

@ -19,7 +19,7 @@
@extends('shared._app_layout')
@section('title'){{ $track->title }} - {{ $track->user->display_name }} | @endsection
@section('description'){{ str_limit($track->description, $limit = 200, $end = '...') }}@endsection
@section('description'){{ Str::limit($track->description, $limit = 200, $end = '...') }}@endsection
@section('metadata')
<meta property="og:title" content="{{ $track->title }}" />
@ -28,7 +28,7 @@
<meta property="og:image" content="{{ $track->getCoverUrl(\App\Models\Image::NORMAL) }}" />
<meta property="og:image:width" content="350" />
<meta property="og:image:height" content="350" />
<meta property="og:description" content="{{ str_limit($track->description, $limit = 200, $end = '...') }}">
<meta property="og:description" content="{{ Str::limit($track->description, $limit = 200, $end = '...') }}">
<meta property="og:site_name" content="Pony.fm" />
<meta property="og:audio" content="{{ $track->getStreamUrl('MP3') }}" />
<meta property="og:audio:secure_url" content="{{ $track->getStreamUrl('MP3') }}" />
@ -39,7 +39,7 @@
<meta name="twitter:card" content="player" />
<meta name="twitter:site" content="@ponyfm" />
<meta name="twitter:title" content="{{ $track->title }}" />
<meta name="twitter:description" content="{{ str_limit($track->description, $limit = 200, $end = '...') }}" />
<meta name="twitter:description" content="{{ Str::limit($track->description, $limit = 200, $end = '...') }}" />
<meta name="twitter:image" content="{{ $track->getCoverUrl(\App\Models\Image::NORMAL) }}" />
<meta name="twitter:player" content="{{ url('t' . $track->id . '/embed?twitter') }}" />
<meta name="twitter:player:width" content="480" />