• Laravel Advanced -> how to pass variable into function?

     public function updateNotificationStatus($userid)

    {

    //update the status to 1 when activity is seen

    $results= DB::table('tablename')

    ->where('status', 0)

    ->whereIn('id', function($query) use ($userid)

    {

    $query->select(DB::raw('id'))

      ->from('tablename')

      ->where(function($q) use ($userid) {

    $q->where('user_id', $userid)

       ->orWhere('staff_id', $userid);

    })->get();

    })

    ->update(['status' => 1]);

            return $results;

    }

  • 0 comments:

    Post a Comment

    FAVOURITE LINE

    To steal ideas from one is plagiarism. To steal from many is Research.

    ADDRESS

    Mumbai , Maharashtra

    EMAIL

    shikha.pathak6@gmail.com
    shikha.the.swt.pari@gmail.com

    Skype

    shikha_pari