title: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'name' in 'where clause' (SQL: select * from `roles` where `name` = user limit 1)
body: <p>I create a new user by fill in all the fields, then when i submit all the new data for user are registred with the correct data in DB but i'm not redirect to index page;I am getting this error:</p>
  
  <p>SQLSTATE[42S22]: Column not found: 1054 Unknown column 'name' in 'where clause' (SQL: select * from <code>roles</code> where <code>name</code> = user limit 1)</p>
  
  <p>this is my user model:</p>
  
  <pre><code>&lt;?php
  
  namespace App;
  
  use Illuminate\Notifications\Notifiable;
  use Illuminate\Foundation\Auth\User as Authenticatable;
  
  class User extends Authenticatable
  {
      use Notifiable;
  
  
  
      /**
       * The attributes that are mass assignable.
       *
       * @var array
       */
      protected $fillable = [
          'name', 'email','user_type', 'password'
      ];
  
      /**
       * The attributes that should be hidden for arrays.
       *
       * @var array
       */
      protected $hidden = [
          'password', 'remember_token',
      ];
  }
  
  </code></pre>
  
  <p>this is my role model:</p>
  
  <pre><code>&lt;?php
  
  namespace App;
  
  use Illuminate\Database\Eloquent\Model;
  
  class Roles extends Model
  {
      //
  
  
       protected $fillable = [
          'libelle'
      ];
  }
  
  </code></pre>
  
  <p>this is my user Controller:</p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers;
  
  use Illuminate\Http\Request;
  use Illuminate\Support\Facades\Hash;
  
  
  use Auth;
  use App\User;
  
  class UserController extends Controller
  {
      /**
       * Display a listing of the resource.
       *
       * @return \Illuminate\Http\Response
       */
  
  public function __construct()
  {
      $this-&gt;middleware('auth');
  }
  
      public function getRowAttributes()
      {
          return view('manage_users.index');
      }
  
  
  
      /**
       * Show the form for creating a new resource.
       *
       * @return \Illuminate\Http\Response
       */
  
      //ouvrir le formulaire
      public function create()
      {
          return view('manage_users/create');
      }
  
      /**
       * Store a newly created resource in storage.
       *
       * @param  \Illuminate\Http\Request  $request
       * @return \Illuminate\Http\Response
       */
  
  
      //save data 
      public function store(Request $request)
      {
          $this-&gt;validate($request,[
  
                'name' =&gt; 'required|string|max:255',
              'email' =&gt; 'required|string|email|max:255',
              'user_type' =&gt; 'required',
              'password' =&gt; 'required|string|min:6|confirmed'
          ]);
  
          $user=new User([
                'name' =&gt; $request-&gt;get('name'),
               'email' =&gt; $request-&gt;get('email'),
               'user_type'  =&gt; $request-&gt;get('user_type'),
               'password' =&gt; bcrypt($request-&gt;get('password'))
  
          ]);
          $user-&gt;save();
          return redirect('manage_users/index')-&gt;with('success','Data Added');
  
      }
  
      /**
  </code></pre>
  
  <p>this is my role Controller:</p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers;
  
  use Illuminate\Http\Request;
  
  use App\Roles;
  
  class RolesController extends Controller
  {
      //
  public function __construct()
  {
      $this-&gt;middleware('auth');
  }
        public function index()
      {
          $roles = Roles::all();
  
          return view('manage_users.create', ['roles' =&gt; $roles]);
      }
  
  
  }
  
  </code></pre>
  
  <p>this is my route in web.php</p>
  
  <pre><code>
  Route::get('manage_users/index', 'UserController@getRowAttributes')-&gt;name('index');
  
  
  //Route::get('manage_users/column_search', 'UserController@getColumnSearch')-&gt;name('column_search');
  
  //Route::get('manage_users/index','UserController@index');
  
  //Route::resource('manage_users','UserController');
  
  Route::get('manage_users/create','UserController@create');
  Route::get('manage_users/create','RolesController@index');
  Route::post('manage_users/create','UserController@store');
  //Route::get('manage_users/index','UserController@index');
  </code></pre>
  
  <p>SQLSTATE[42S22]: Column not found: 1054 Unknown column 'name' in 'where clause' (SQL: select * from <code>roles</code> where <code>name</code> = user limit 1)</p>