How to check if submitted data to a database is unique?

  laravel, php

I am new to Laravel and I have run into an issue where when I check if data submitted is unique to a database is unique I get this error:

SQLSTATE[42S22]: Column not found: 1054 Unknown column '0' in 'where clause' (SQL: select * from `users` where `0` in ([email protected], asd) limit 1) 

This is my code in Laravel:


namespace AppHttpControllersAuth;

use AppHttpControllersController;
use AppModelsUser;
use IlluminateHttpRequest;
use IlluminateSupportFacadesHash;

class RegisterController extends Controller
    public function index(){
        return view('auth.register');
    public function store(Request $request){
        $this->validate($request, [
            'name'  => [
            'username' => [
            'email' => [
            'password' => [

            'name'      => $request->name,
            'username'  => $request->username,
            'email'     => $request->email,
            'password'  => Hash::make($request->password)
        auth()->attempt([$request->only('email', 'password')]);
        return redirect()->route('dashboard');

I thought the unique parameter checked if a value is unique or not.

It technically does check for it but when I submit a new value which is unique it throws the error, it does get entered into the database.

How to fix this?

Source: Ask PHP