Help us understand the problem. What is going on with this article?

Laravel5.8の準備:ヘルパー

Laravel5.8では一部のヘルパー(array_*str_**_case等)が非推奨になる。たぶん5.9で削除。
すでに大量に使ってるなら修正せずにこのヘルパーパッケージを使ってそのまま使い続ければいい。
https://github.com/laravel/helpers
自分のプロジェクト内は修正しても結局外部のパッケージが使ってて必要になると予想してる。
パッケージ作ってる人は対応しよう。

Bladeでは

この提案した人Blade書いてないのかよってほどにBladeでは不便になる。
https://github.com/laravel/framework/pull/26898

ヘルパーならこれだけなのに

{{ str_limit($content, 140) }}

フルで書くとこれ…。

{{ \Illuminate\Support\Str::limit($content, 140) }}

ひどいけど良い解決方法があった。

config/app.phpのaliasesに追加。

'aliases' => [
    ...

    'Str'          => \Illuminate\Support\Str::class,
    'Arr'          => \Illuminate\Support\Arr::class,
],

こう書けるので短くなった。

{{ Str::limit($content, 140) }}

ヘルパー使わないならこれ。

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away