vendredi 31 janvier 2020

SQl queries are throwing error maria Db Offset Problem laravel php

Recently I have deleted my vendor folder and reinstalled. After that change my all get queries are throwing error. I have no clue what i am missing.

Thanks

/Error/

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'offset 0' at line 1

My Code:

public function couponList(Request $request){
        $sort_by = $request->get('sort-by');
        $order_by = $request->get('order-by');
        $homeTitle = 'Coupons and List'; 
        $coupons = DB::table('sb_coupons AS CO')
        ->select('CO.*','CO.status as couponStatus','CO.created_at as couponOrderDate','UT.*',
        'UT.firstname as userName')
        ->leftJoin('sb_customer AS UT', 'UT.customer_id', '=', 'CO.user_id');
        if(!empty($request->s)){
            $coupons->Where('CO.coupon_code', 'like', '%' . $request->s . '%');
        }
        if ($request->has('status')) {
            $coupons->where('CO.status', $request->status);
        }
        $coupons = $coupons->paginate(env('RECORD_PER_PAGE'));              
        $coupons->appends($request->s); 

        return view('admin.coupons.coupon-list',array('homeTitle'=>$homeTitle,'coupons'=>$coupons,'params'=>$request, 'sort_by'=> $sort_by , 'order_by' => $order_by))
        ->with('i', ($request->input('page', 1) - 1) * env('RECORD_PER_PAGE'));
    }

***.env *

APP_NAME=DeliverMyOrders
APP_ENV=local
APP_KEY=base64:LiLofkwJXFVZd4ZeUvGz/UADUFOeqx+Yeqv7L1gBHvY=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=delivermyorders
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
RECORD_PER_PAGE=10

FACEBOOK_ID=458516817946384
FACEBOOK_SECRET=9660233aee1cf8b443e4586ea864ea1a
FACEBOOK_URL=http://localhost:8000/auth/facebook/callback/


GOOGLE_ID=1512483269952
GOOGLE_SECRET=AIzaSyB-AiSA4Kd-R36M6J7NSTXxAWbVs7z4C_s
GOOGLE_URL=http://localhost:8000/auth/google/callback


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire