user3718908x100
user3718908x100

Reputation: 8509

Exception: trim epects parameter 1 to be string, array given

Hello i recently tried to implement JWT authentication in my app by following this tutorial i found online:

cookie-free-authentication-with-json-web-tokens-an-example-in-laravel-and-angularjs

However when trying to install the following package:

barryvdh/laravel-cors 0.4.x@dev

I got an error exception when trying to run php artisan clear-compiled and later when i tried to run php artisan vendor:publish

This is the error:

[ErrorException]
trim() expects parameter 1 to be string, array given

Edit: I just removed the package and tried running composer update, had the same error again.

Upvotes: 2

Views: 6990

Answers (1)

user3718908x100
user3718908x100

Reputation: 8509

Okay i found the error, it had to do with my routes file:

Route::any(['{url?}'], function($url) {
    return view('website/index');
})->where(['url' => '[-a-zA-Z0-9/]+']);

I removed the square brackets and now it works, must have accidentally put it there:

Route::any('{url?}', function($url) {
    return view('website/index');
})->where(['url' => '[-a-zA-Z0-9/]+']);

Not gonna delete though, somebody might find this useful lol xD xD

Upvotes: 4

Related Questions