man-u-l
1 week ago
13981
4
Laravel

Problem adding macro to app/Providers/AppServiceProvider.php

Posted 1 week ago by man-u-l

I added:

Str::macro('done', function ($value) {
      return (string) $value;
});

To app/Providers/AppServiceProvider.php inside the boot method but when I try to use it as such:

Str::of(‘text’)->append(‘content’)->done();

I get error: Method Illuminate\Support\Stringable::done does not exist.

I have cleared cache and ran composer dump-autoload but same problem.

Any suggestions?

Please sign in or create an account to participate in this conversation.