How to write a database query to fetch all records whose column value is 1 in laravel-8?

I am developing one API which is responsible for fetching the (records)data whose cart(column) value is equal to 1 , How to acheive this thing please help me

This is how i am getting error

IlluminateDatabaseQueryException: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'bookstore.books.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by (SQL: select * from `books` group by `cart` having `cart` > 0) in file C:xampphtdocslaravel-bookstorevendorlaravelframeworksrcIlluminateDatabaseConnection.php 

FileController.php

 public function cartItem(){
        $books=Books::all();
        if(User::find($books->user_id=auth()->id())->books){
           $users=DB::table('books')->groupBy('cart')->having('cart','>',0)->get();
            // $users=DB::table('books')->whereIn('cart',[1])->get();
            return response()->json(['books'=>$users],200);
        }
    }

Books_Migration_Table.php

<?php

use IlluminateDatabaseMigrationsMigration;
use IlluminateDatabaseSchemaBlueprint;
use IlluminateSupportFacadesSchema;

class CreateBooksTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('books', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('author');
            $table->integer('price');
            $table->integer('quantity');
            $table->string('file')->nullable();
            $table->longText('description');
            $table->unsignedBigInteger('user_id');
            $table->enum('cart', [0, 1])->default(0);
            $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
            $table->timestamps();
        });
    }

Answer

Try this one

    $books_record = DB::table('books')->where(['cart', '=', '1'])->get();