Skip to content
Advertisement

Class ‘session’ not found (View: C:xampphtdocsLARAVELLARAVELresourcesviewswelcome.blade.php)

Here, I am trying to create a signup page using laravel. However, I’m having problems with the part of the code that has “session”. When I take that part out, the code works but when I leave it in, it doesn’t. The tutorial that I got the code from says that the sessions part of the code is very important for security. Here is the code:

section ('content')
<div class = "row">
    <div class = "col-md-6">
        <h3> Sign Up </h3>
        <form action ="{{route ('signup')}}" method = "post">
          <div class = "form-group">
                <label for= "email"> your E-mail </label>
                <input class = "form-control" type="text" name = "email" id= "email">
          </div>
          <div class = "form-group">
                <label for= "first_name"> your first name </label>
                <input class = "form-control" type="text" name = "first_name" id= "first_name">
          </div>
          
          <div class = "form-group">
                <label for= "password"> your password </label>
                <input class = "form-control" type="password" name = "password" id= "password">    
          </div>
          <button type = "submit" class = "btn btn-primary">submit</button>
        <input type = "hidden" name = "_token" value="{{session::token() }}">
        </form>
                 

Advertisement

Answer

Use Session instead of session. Note, that S is capital. If that does not work go for : Session::token()

Thanks

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement