0

I'm trying to upgrade a Laravel project. I downloaded online to version 8 but on getting to version 6 I keep getting:

In session.php line 127: Class 'Str' not found

in my command line. What am I doing wrong please.

This is line 127

Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
Tim Lewis
  • 27,813
  • 13
  • 73
  • 102
Iam-kelvin
  • 25
  • 3

2 Answers2

2

I think you need to add

use Illuminate\Support\Str;

to the top of your session.php configuration file.

In version 5.0 this was never a thing and was introduced in Laravel 6.

References:

Laravel 5: https://github.com/laravel/laravel/blob/5.0/config/session.php

Laravel 6: https://github.com/laravel/laravel/blob/6.x/config/session.php

0

This error appears because laravel not able to find the namespace of Str try this.

on top of your file write this line use Illuminate\Support\Str or simply \Str