ssquare

ssquare

Member Since 6 Months Ago

Experience Points 1,520
Experience Level 1

3,480 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed 1
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

16 Feb
3 days ago

ssquare left a reply on Best Way To Handle Huge Insertion In Laravel Considering Both Timeout And Memory Issue

By that way, will the first job shut automatically or because of the chaining of the 2nd job from first job, will that 2nd job considered as the part of first job?

14 Feb
5 days ago

ssquare started a new conversation Best Way To Handle Huge Insertion In Laravel Considering Both Timeout And Memory Issue

Currently, I am trying to insert data to the database using Laravel Queue. This is importing data from csv formatting some columns and the finally dump to the database.

The size of this csv is so huge that it could take more than 24 hours or even more as it has more than 500k rows of data.

Previously, I thought this queue is going to work with no time limits and memory but it does not seem to work in that way.

I am using LeagueCSV and reading csv rows on chunk until the read rows are not empty. This is reading data in for each loop.

How can I deal with this, Let me know if you need any more information?

Let me know if there is a way to break job connection and reconnect and work from next chunk removing this timeout and out of memory issue.

ssquare started a new conversation Raw Query Not Running

I am trying to run raw query as follow:

$rawStatement = 'SELECT table_rows "Rows Count" FROM information_schema.tables WHERE table_name="table_name" AND table_schema="db_name"';
DB::statement(DB::raw($rawStatement));

ERROR:

Too few arguments to function Illuminate\Database\Connection::raw(), 0 passed in D:\wamp64\www\project\vendor\laravel\framework\src\Illuminate\Database\DatabaseManager.php on line 327 and exactly 1 expected

This sql is running from phpyadmin

04 Feb
2 weeks ago

ssquare started a new conversation Extra Data Not Sending To Server Using Ajax Datatable

I am detecting page click "First", "Previous", "Next", "Last" using a callback function and trying to send this data to the server.

I could successfully detect and console.log the current page, however, I am unable to send data to the server.

var page;
var dataTable = $('#DataTable').DataTable( {

                drawCallback: function(){
                    $('.paginate_button.first:not(.disabled)', this.api().table().container())          
                    .on('click', function(){
                        page = 'first';
                        console.log(page);
                    });
                    $('.paginate_button.previous:not(.disabled)', this.api().table().container())          
                    .on('click', function(){
                        page = 'previous';
                        console.log(page);
                    });
                    $('.paginate_button.next:not(.disabled)', this.api().table().container())          
                    .on('click', function(){
                        page = 'next';
                        console.log(page);
                    });
                    $('.paginate_button.last:not(.disabled)', this.api().table().container())          
                    .on('click', function(){
                        page = 'last';
                        console.log(page);
                    });       
                },
    "ajax": {
                    "url":base_path +'/other_path',
                    "dataType":"json",
                    "type":"POST",
                    "data":{"_token":csrf_token,"page":page}
                }
        ......
});

Header, does not show any page information being sent

08 Jan
1 month ago

ssquare left a reply on Help Needed To Convert Update Query To UpdateOrCreate

@snapey I got the sense but could you suggest me how can I filter and create $student with only fields that are present. You can see my previous logic in question.

ssquare left a reply on Help Needed To Convert Update Query To UpdateOrCreate

How am I supposed to get that student_id???? As this is the scenario of update or create. If there was some field something like id. Will it ever be necessary to write such long code?

ssquare left a reply on Help Needed To Convert Update Query To UpdateOrCreate

@vajid the phone and email are not compulsory fields. They might be present or not. So, its necessary to check them if they are present.

ssquare left a reply on Help Needed To Convert Update Query To UpdateOrCreate

@vajid and what about this part

->where(function($query) use ($student) {
        if (array_key_exists('phone_preferred', $student) && !empty($student['phone_preferred'])) {
            $query->where('phone_preferred', $student['phone_preferred']);
        }

        if (array_key_exists('email_preferred', $student) && !empty($student['email_preferred'])) {
            $query->where('email_preferred', $student['email_preferred']);
        }

        if (array_key_exists('home_street_address_1', $student) && !empty($student['home_street_address_1'])) {
            $query->where('home_street_address_1', $student['home_street_address_1']);
        }

        if (array_key_exists('mailing_street_address_1', $student) && !empty($student['mailing_street_address_1'])) {
            $query->where('mailing_street_address_1', $student['mailing_street_address_1']);
        }
        
        if (array_key_exists('mailing_address_city', $student) && !empty($student['mailing_address_city'])) {
            $query->where('mailing_address_city', $student['mailing_address_city']);
        }

ssquare started a new conversation Help Needed To Convert Update Query To UpdateOrCreate

My current code:

$existing = Student::where('name_last', $student['name_last'])
    ->where('name_first', $student['name_first'])
    ->where(function($query) use ($student) {
        if (array_key_exists('phone_preferred', $student) && !empty($student['phone_preferred'])) {
            $query->where('phone_preferred', $student['phone_preferred']);
        }

        if (array_key_exists('email_preferred', $student) && !empty($student['email_preferred'])) {
            $query->where('email_preferred', $student['email_preferred']);
        }

        if (array_key_exists('home_street_address_1', $student) && !empty($student['home_street_address_1'])) {
            $query->where('home_street_address_1', $student['home_street_address_1']);
        }

        if (array_key_exists('mailing_street_address_1', $student) && !empty($student['mailing_street_address_1'])) {
            $query->where('mailing_street_address_1', $student['mailing_street_address_1']);
        }
        
        if (array_key_exists('mailing_address_city', $student) && !empty($student['mailing_address_city'])) {
            $query->where('mailing_address_city', $student['mailing_address_city']);
        }

 })->first();

 if($existing){

        try{
            Student::where('id', $existing->id)
            ->update($student);
            } catch (\Exception $e) {
             $error_encountered = true;
             $error_arr[] = $e->getMessage();
             $error_row_numbers[] = $row_no; 
            }

}

I could convert it to update or create in following ways.

        try{
            Student::updateOrCreatewhere(
                         ['name_first' => $student['name_first], 'name_last' => $student['name_last]],
                        $student
               );
    
            } catch (\Exception $e) {
             $error_encountered = true;
             $error_arr[] = $e->getMessage();
             $error_row_numbers[] = $row_no; 
            }

But, I could not get how to implement that where query functions in this updateOrCreate.

17 Dec
2 months ago

ssquare started a new conversation Laravel Create Method Inserting Timestamp To Updated_at Column As Well

I am trying to insert data with something simple like

$data_arr['created_by'] = $this->data['user_id'];
$data_table = Model::create($data_arr);

But it is updating both created_at and updated_at table at once. I don't want to fill updated_at column at the time of creation.

How can I get rid of this?

12 Dec
2 months ago

ssquare started a new conversation Help To Implement Logic By Detecting End Of File And Loop Out While Parsing Csv And Dumping To Database

I am using CSVLeague to parse csv file and then later dumping those data to the database. The structure looks like.

$loop = true;

            while($loop){

                    $stmt = (new Statement())
                    ->offset($offset)
                    ->limit($limit)
                    ;

                    $records = $stmt->process($csv);

                    foreach ($records as $record) 
                    {
                        $rec_arr[] = array_values($record);  
                    }

                    $records_arr = $service->trimArray($rec_arr);  //removes if any empty row 
 encounters 

                    if(count($records_arr)>0){
                foreach($records_arr as $rk => $rv){
                    //here map csv column to database column and insert into database
                }
                $offset = $offset + $limit; 
            }else{
                $loop = false;  
            }

Currently, I am implementing this logic inside laravel queue. It is successfully inserting the whole set of data but it is not halting the process. It keeps stuck with message processing. However, if I removed that while loop then it will be stopped with message processed. So, I think it should be something that I am implementing some bad logic there.

Looking for an idea to tackle with this.

ssquare left a reply on Illuminate\Database\Eloquent\ModelNotFoundException: No Query Results For Model [App\Models\Model_name] Inside Laravel JOB

@mithrandir Thank you. I just removed those lines from construct and create directly inside handle as $model = new Model().

11 Dec
2 months ago

ssquare left a reply on Illuminate\Database\Eloquent\ModelNotFoundException: No Query Results For Model [App\Models\Model_name] Inside Laravel JOB

Well, that's not the full code. I was just trying to print out $records_arr till that. But, later it will be used in something like:

if(count($records_arr)>0)
            {
                foreach($records_arr as $ck => $cv){


                    $colorado_voter_arr = array();
                    foreach ($map_data as $mk => $mv) {
                        if(!isset($skip[$mk])){
                                // if (strpos($mv, '_date') !== false) {
                            $data_type = $this->service->getDatabaseColumnType($this->table,$mv);
                            if($data_type == 'date' || $data_type == 'datetime' || $data_type == 'timestamp'){
                                $datetime =  (array)$cv[$mk];
                                $dt = array_shift($datetime);
                                $dt = date('Y-m-d h:i:s', strtotime($dt));
                                $colorado_voter_arr[$mv] = $dt;
                            }else{
                                $colorado_voter_arr[$mv] = $cv[$mk];
                            }  
                /*Some other code*/
                 Colorado_voter::create($colorado_voter_arr);

                        }
                    }
        }
}

ssquare started a new conversation Illuminate\Database\Eloquent\ModelNotFoundException: No Query Results For Model [App\Models\Model_name] Inside Laravel JOB

I am trying to dump data from csv to database. But, I am getting an error as ModelNotFound inside laravel job. Although I have already imported model.

Error

Illuminate\Database\Eloquent\ModelNotFoundException: No query results for model [App\Models\Colorado_voter]. in D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Builder.php:414
Stack trace:
#0 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\SerializesAndRestoresModelIdentifiers.php(85): Illuminate\Database\Eloquent\Builder->firstOrFail()
#1 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\SerializesAndRestoresModelIdentifiers.php(55): App\Jobs\StoreColorado->restoreModel(Object(Illuminate\Contracts\Database\ModelIdentifier))
#2 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\SerializesModels.php(45): App\Jobs\StoreColorado->getRestoredPropertyValue(Object(Illuminate\Contracts\Database\ModelIdentifier))
#3 [internal function]: App\Jobs\StoreColorado->__wakeup()
#4 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\CallQueuedHandler.php(42): unserialize('O:22:"App\Jobs\...')
#5 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Jobs\Job.php(83): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\DatabaseJob), Array)
#6 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(326): Illuminate\Queue\Jobs\Job->fire()
#7 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(276): Illuminate\Queue\Worker->process('database', Object(Illuminate\Queue\Jobs\DatabaseJob), Object(Illuminate\Queue\WorkerOptions))
#8 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(118): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\DatabaseJob), 'database', Object(Illuminate\Queue\WorkerOptions))
#9 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Console\WorkCommand.php(101): Illuminate\Queue\Worker->daemon('database', 'default', Object(Illuminate\Queue\WorkerOptions))
#10 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Console\WorkCommand.php(85): Illuminate\Queue\Console\WorkCommand->runWorker('database', 'default')
#11 [internal function]: Illuminate\Queue\Console\WorkCommand->handle()
#12 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(29): call_user_func_array(Array, Array)
#13 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#14 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#15 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Container\Container.php(564): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#16 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Console\Command.php(179): Illuminate\Container\Container->call(Array)
#17 D:\wamp64\www\kabza\vendor\symfony\console\Command\Command.php(255): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#18 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Console\Command.php(166): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#19 D:\wamp64\www\kabza\vendor\symfony\console\Application.php(886): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 D:\wamp64\www\kabza\vendor\symfony\console\Application.php(262): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 D:\wamp64\www\kabza\vendor\symfony\console\Application.php(145): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Console\Application.php(89): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(122): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 D:\wamp64\www\kabza\artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 {main}

My JobFile

<?php

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;

use League\Csv\Reader;
use League\Csv\Statement;

use App\Http\Service\KabzaService;
use App\Models\Colorado_voter;
use App\Models\Base_voter;

class StoreColorado implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    /**
     * Create a new job instance.
     *
     * @return void
     */

    private $service;
    private $table_name;
    private $dbase;

    public function __construct() {  
        $this->service = new KabzaService();
        $this->table = 'colorado_voter';
        $this->dbase = new Colorado_voter();
    }
 
    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        $offset = 0;
        $limit = 50;
        $filename = '1000.csv';

        $skip = array
        (
            8 => 1,
            25 => 1,
            26 => 1,
            27 => 1,
            31 => 1,
            44 => 1,
            49 => 1
        );
        $map_data = array
        (
            0 => 'voter_id',
            1 => 'voter_county_code',
            2 => 'voter_county',
            3 => 'name_last',
            4 => 'name_first',
            5 => 'name_middle',
            6 => 'name_suffix',
            7 => 'name_voter',
            8 => 'id',
            9 => 'voter_precinct_name',
            10 => 'voter_library_id',
            11 => 'home_house_number',
            12 => 'home_house_suffix',
            13 => 'home_direction',
            14 => 'home_street_name',
            15 => 'home_street_type',
            16 => 'home_direction',
            17 => 'home_unit_type',
            18 => 'home_unit_number',
            19 => 'home_street_address_1',
            20 => 'home_address_city',
            21 => 'home_address_state',
            22 => 'home_address_zip',
            23 => 'home_address_zip_plus',
            24 => 'home_address_effective_date',
            25 => 'id',
            26 => 'id',
            27 => 'id',
            28 => 'birth_year',
            29 => 'gender',
            30 => 'voter_precinct_name',
            31 => 'id',
            32 => 'voter_status_id',
            33 => 'voter_party',
            34 => 'voter_party_affiliation_date',
            35 => 'phone_preferred',
            36 => 'mailing_street_address_1',
            37 => 'mailing_street_address_2',
            38 => 'mailing_street_address_3',
            39 => 'mailing_address_city',
            40 => 'mailing_address_state',
            41 => 'mailing_address_zip',
            42 => 'mailing_address_zip_plus',
            43 => 'mailing_address_country',
            44 => 'id',
            45 => 'permanent_mail_in_voter',
            46 => 'voter_congressional_district',
            47 => 'voter_state_district',
            48 => 'voter_house_district',
            49 => 'id'
        );

        $db_header_obj = new Colorado_voter();
        $db_header = $db_header_obj->getTableColumns();

        $base_voter_header = new Base_voter();
        $base_voter_columns = $base_voter_header->getTableColumns();

        $csv_file_path = storage_path('app/files/colorado_voter/').$filename;
        if (!ini_get("auto_detect_line_endings")) {
            ini_set("auto_detect_line_endings", TRUE);
        }
        $csv = Reader::createFromPath($csv_file_path, 'r');

        $csv->setOutputBOM(Reader::BOM_UTF8);
        $csv->addStreamFilter('convert.iconv.ISO-8859-15/UTF-8');

            $csv->setHeaderOffset(0); //set the CSV header offset
            $csv_header = $csv->getHeader();    

            $rec_arr = array();
            $records = array();
            $records_arr = array();

            $stmt = (new Statement())
            ->offset($offset)
            ->limit($limit)
            ;

            $records = $stmt->process($csv);

            foreach ($records as $record) 
            {
                $rec_arr[] = array_values($record);
            }

            $records_arr = $this->service->trimArray($rec_arr);

            print_r($records_arr);

            if (!ini_get("auto_detect_line_endings")) {
                ini_set("auto_detect_line_endings", FALSE);
            }
        }


}

Skip and map data are just an array used to determine which column from csv map to which column in database

ssquare left a reply on SQLSTATE[42S02]: [Microsoft][ODBC Driver 13 For SQL Server][SQL Server]Invalid Object Name 'failed_jobs'.

@globals Could you suggest why it is saying, model, not found. I think I have used use App\Models\Colorado_voter; there.

ssquare left a reply on SQLSTATE[42S02]: [Microsoft][ODBC Driver 13 For SQL Server][SQL Server]Invalid Object Name 'failed_jobs'.

@globals I have added that. But still, it showing error as some thing like

Illuminate\Database\Eloquent\ModelNotFoundException: No query results for model [App\Models\Colorado_voter]. in D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Builder.php:414
Stack trace:
#0 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\SerializesAndRestoresModelIdentifiers.php(85): Illuminate\Database\Eloquent\Builder->firstOrFail()
#1 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\SerializesAndRestoresModelIdentifiers.php(55): App\Jobs\StoreColorado->restoreModel(Object(Illuminate\Contracts\Database\ModelIdentifier))
#2 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\SerializesModels.php(45): App\Jobs\StoreColorado->getRestoredPropertyValue(Object(Illuminate\Contracts\Database\ModelIdentifier))
#3 [internal function]: App\Jobs\StoreColorado->__wakeup()
#4 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\CallQueuedHandler.php(42): unserialize('O:22:"App\Jobs\...')
#5 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Jobs\Job.php(83): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\DatabaseJob), Array)
#6 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(326): Illuminate\Queue\Jobs\Job->fire()
#7 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(276): Illuminate\Queue\Worker->process('database', Object(Illuminate\Queue\Jobs\DatabaseJob), Object(Illuminate\Queue\WorkerOptions))
#8 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(118): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\DatabaseJob), 'database', Object(Illuminate\Queue\WorkerOptions))
#9 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Console\WorkCommand.php(101): Illuminate\Queue\Worker->daemon('database', 'default', Object(Illuminate\Queue\WorkerOptions))
#10 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Console\WorkCommand.php(85): Illuminate\Queue\Console\WorkCommand->runWorker('database', 'default')
#11 [internal function]: Illuminate\Queue\Console\WorkCommand->handle()
#12 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(29): call_user_func_array(Array, Array)
#13 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#14 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#15 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Container\Container.php(564): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#16 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Console\Command.php(179): Illuminate\Container\Container->call(Array)
#17 D:\wamp64\www\kabza\vendor\symfony\console\Command\Command.php(255): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#18 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Console\Command.php(166): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#19 D:\wamp64\www\kabza\vendor\symfony\console\Application.php(886): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 D:\wamp64\www\kabza\vendor\symfony\console\Application.php(262): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 D:\wamp64\www\kabza\vendor\symfony\console\Application.php(145): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Console\Application.php(89): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(122): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 D:\wamp64\www\kabza\artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 {main}

ssquare started a new conversation SQLSTATE[42S02]: [Microsoft][ODBC Driver 13 For SQL Server][SQL Server]Invalid Object Name 'failed_jobs'.

I have a demo csv file and I want to dump this data from csv file to database using laravel jobs. But I am receiving the following error.

[2018-12-11 05:46:23] local.ERROR: SQLSTATE[42S02]: [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Invalid object name 'failed_jobs'. (SQL: insert into [failed_jobs] ([connection], [queue], [payload], [exception], [failed_at]) values (database, default, {"displayName":"App\Jobs\StoreColorado","job":"Illuminate\Queue\[email protected]","maxTries":null,"timeout":null,"timeoutAt":null,"data":{"commandName":"App\Jobs\StoreColorado","command":"O:22:\"App\Jobs\StoreColorado\":10:{s:31:\"\u0000App\Jobs\StoreColorado\u0000service\";O:29:\"App\Http\Service\KabzaService\":0:{}s:34:\"\u0000App\Jobs\StoreColorado\u0000table_name\";N;s:29:\"\u0000App\Jobs\StoreColorado\u0000dbase\";O:45:\"Illuminate\Contracts\Database\ModelIdentifier\":4:{s:5:\"class\";s:25:\"App\Models\Colorado_voter\";s:2:\"id\";N;s:9:\"relations\";a:0:{}s:10:\"connection\";N;}s:6:\"\u0000*\u0000job\";N;s:10:\"connection\";N;s:5:\"queue\";N;s:15:\"chainConnection\";N;s:10:\"chainQueue\";N;s:5:\"delay\";O:13:\"Carbon\Carbon\":3:{s:4:\"date\";s:26:\"2018-12-11 05:46:21.085543\";s:13:\"timezone_type\";i:3;s:8:\"timezone\";s:3:\"UTC\";}s:7:\"chained\";a:0:{}}"}}, Illuminate\Database\Eloquent\ModelNotFoundException: No query results for model [App\Models\Colorado_voter]. in D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Builder.php:414
Stack trace:
#0 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\SerializesAndRestoresModelIdentifiers.php(85): Illuminate\Database\Eloquent\Builder->firstOrFail()
#1 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\SerializesAndRestoresModelIdentifiers.php(55): App\Jobs\StoreColorado->restoreModel(Object(Illuminate\Contracts\Database\ModelIdentifier))
#2 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\SerializesModels.php(45): App\Jobs\StoreColorado->getRestoredPropertyValue(Object(Illuminate\Contracts\Database\ModelIdentifier))
#3 [internal function]: App\Jobs\StoreColorado->__wakeup()
#4 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\CallQueuedHandler.php(42): unserialize('O:22:"App\Jobs\...')
#5 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Jobs\Job.php(83): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\DatabaseJob), Array)
#6 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(326): Illuminate\Queue\Jobs\Job->fire()
#7 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(276): Illuminate\Queue\Worker->process('database', Object(Illuminate\Queue\Jobs\DatabaseJob), Object(Illuminate\Queue\WorkerOptions))
#8 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(118): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\DatabaseJob), 'database', Object(Illuminate\Queue\WorkerOptions))
#9 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Console\WorkCommand.php(101): Illuminate\Queue\Worker->daemon('database', 'default', Object(Illuminate\Queue\WorkerOptions))
#10 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Console\WorkCommand.php(85): Illuminate\Queue\Console\WorkCommand->runWorker('database', 'default')
#11 [internal function]: Illuminate\Queue\Console\WorkCommand->handle()
#12 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(29): call_user_func_array(Array, Array)
#13 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#14 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#15 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Container\Container.php(564): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#16 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Console\Command.php(179): Illuminate\Container\Container->call(Array)
#17 D:\wamp64\www\kabza\vendor\symfony\console\Command\Command.php(255): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#18 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Console\Command.php(166): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#19 D:\wamp64\www\kabza\vendor\symfony\console\Application.php(886): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 D:\wamp64\www\kabza\vendor\symfony\console\Application.php(262): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 D:\wamp64\www\kabza\vendor\symfony\console\Application.php(145): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Console\Application.php(89): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(122): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 D:\wamp64\www\kabza\artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 {main}, 2018-12-11 05:46:23.888)) {"exception":"[object] (Illuminate\Database\QueryException(code: 42S02): SQLSTATE[42S02]: [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Invalid object name 'failed_jobs'. (SQL: insert into [failed_jobs] ([connection], [queue], [payload], [exception], [failed_at]) values (database, default, {\"displayName\":\"App\\Jobs\\StoreColorado\",\"job\":\"Illuminate\\Queue\\[email protected]\",\"maxTries\":null,\"timeout\":null,\"timeoutAt\":null,\"data\":{\"commandName\":\"App\\Jobs\\StoreColorado\",\"command\":\"O:22:\\"App\\Jobs\\StoreColorado\\":10:{s:31:\\"\u0000App\\Jobs\\StoreColorado\u0000service\\";O:29:\\"App\\Http\\Service\\KabzaService\\":0:{}s:34:\\"\u0000App\\Jobs\\StoreColorado\u0000table_name\\";N;s:29:\\"\u0000App\\Jobs\\StoreColorado\u0000dbase\\";O:45:\\"Illuminate\\Contracts\\Database\\ModelIdentifier\\":4:{s:5:\\"class\\";s:25:\\"App\\Models\\Colorado_voter\\";s:2:\\"id\\";N;s:9:\\"relations\\";a:0:{}s:10:\\"connection\\";N;}s:6:\\"\u0000*\u0000job\\";N;s:10:\\"connection\\";N;s:5:\\"queue\\";N;s:15:\\"chainConnection\\";N;s:10:\\"chainQueue\\";N;s:5:\\"delay\\";O:13:\\"Carbon\\Carbon\\":3:{s:4:\\"date\\";s:26:\\"2018-12-11 05:46:21.085543\\";s:13:\\"timezone_type\\";i:3;s:8:\\"timezone\\";s:3:\\"UTC\\";}s:7:\\"chained\\";a:0:{}}\"}}, Illuminate\Database\Eloquent\ModelNotFoundException: No query results for model [App\Models\Colorado_voter]. in D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Builder.php:414
Stack trace:
#0 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\SerializesAndRestoresModelIdentifiers.php(85): Illuminate\Database\Eloquent\Builder->firstOrFail()
#1 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\SerializesAndRestoresModelIdentifiers.php(55): App\Jobs\StoreColorado->restoreModel(Object(Illuminate\Contracts\Database\ModelIdentifier))
#2 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\SerializesModels.php(45): App\Jobs\StoreColorado->getRestoredPropertyValue(Object(Illuminate\Contracts\Database\ModelIdentifier))
#3 [internal function]: App\Jobs\StoreColorado->__wakeup()
#4 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\CallQueuedHandler.php(42): unserialize('O:22:\"App\\Jobs\\...')
#5 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Jobs\Job.php(83): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\DatabaseJob), Array)
#6 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(326): Illuminate\Queue\Jobs\Job->fire()
#7 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(276): Illuminate\Queue\Worker->process('database', Object(Illuminate\Queue\Jobs\DatabaseJob), Object(Illuminate\Queue\WorkerOptions))
#8 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(118): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\DatabaseJob), 'database', Object(Illuminate\Queue\WorkerOptions))
#9 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Console\WorkCommand.php(101): Illuminate\Queue\Worker->daemon('database', 'default', Object(Illuminate\Queue\WorkerOptions))
#10 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Console\WorkCommand.php(85): Illuminate\Queue\Console\WorkCommand->runWorker('database', 'default')
#11 [internal function]: Illuminate\Queue\Console\WorkCommand->handle()
#12 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(29): call_user_func_array(Array, Array)
#13 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#14 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#15 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Container\Container.php(564): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#16 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Console\Command.php(179): Illuminate\Container\Container->call(Array)
#17 D:\wamp64\www\kabza\vendor\symfony\console\Command\Command.php(255): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#18 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Console\Command.php(166): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#19 D:\wamp64\www\kabza\vendor\symfony\console\Application.php(886): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 D:\wamp64\www\kabza\vendor\symfony\console\Application.php(262): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 D:\wamp64\www\kabza\vendor\symfony\console\Application.php(145): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Console\Application.php(89): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(122): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 D:\wamp64\www\kabza\artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 {main}, 2018-12-11 05:46:23.888)) at D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Database\Connection.php:664, Doctrine\DBAL\Driver\PDOException(code: 42S02): SQLSTATE[42S02]: [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Invalid object name 'failed_jobs'. at D:\wamp64\www\kabza\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOStatement.php:144, PDOException(code: 42S02): SQLSTATE[42S02]: [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Invalid object name 'failed_jobs'. at D:\wamp64\www\kabza\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOStatement.php:142, Illuminate\Database\Eloquent\ModelNotFoundException(code: 0): No query results for model [App\Models\Colorado_voter]. at D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Builder.php:414)
[stacktrace]
#0 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Database\Connection.php(624): Illuminate\Database\Connection->runQueryCallback('insert into [fa...', Array, Object(Closure))
#1 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Database\Connection.php(459): Illuminate\Database\Connection->run('insert into [fa...', Array, Object(Closure))
#2 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Database\Connection.php(411): Illuminate\Database\Connection->statement('insert into [fa...', Array)
#3 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Database\Query\Processors\SqlServerProcessor.php(24): Illuminate\Database\Connection->insert('insert into [fa...', Array)
#4 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Database\Query\Builder.php(2494): Illuminate\Database\Query\Processors\SqlServerProcessor->processInsertGetId(Object(Illuminate\Database\Query\Builder), 'insert into [fa...', Array, NULL)
#5 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Failed\DatabaseFailedJobProvider.php(62): Illuminate\Database\Query\Builder->insertGetId(Array)
#6 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Console\WorkCommand.php(188): Illuminate\Queue\Failed\DatabaseFailedJobProvider->log('database', 'default', '{\"displayName\":...', 'Illuminate\\Data...')
#7 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Console\WorkCommand.php(137): Illuminate\Queue\Console\WorkCommand->logFailedJob(Object(Illuminate\Queue\Events\JobFailed))
#8 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Events\Dispatcher.php(360): Illuminate\Queue\Console\WorkCommand->Illuminate\Queue\Console\{closure}(Object(Illuminate\Queue\Events\JobFailed))
#9 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Events\Dispatcher.php(209): Illuminate\Events\Dispatcher->Illuminate\Events\{closure}('Illuminate\\Queu...', Array)
#10 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\FailingJob.php(36): Illuminate\Events\Dispatcher->dispatch('Illuminate\\Queu...')
#11 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\CallQueuedHandler.php(131): Illuminate\Queue\FailingJob::handle('database', Object(Illuminate\Queue\Jobs\DatabaseJob), Object(Illuminate\Database\Eloquent\ModelNotFoundException))
#12 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\CallQueuedHandler.php(45): Illuminate\Queue\CallQueuedHandler->handleModelNotFound(Object(Illuminate\Queue\Jobs\DatabaseJob), Object(Illuminate\Database\Eloquent\ModelNotFoundException))
#13 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Jobs\Job.php(83): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\DatabaseJob), Array)
#14 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(326): Illuminate\Queue\Jobs\Job->fire()
#15 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(276): Illuminate\Queue\Worker->process('database', Object(Illuminate\Queue\Jobs\DatabaseJob), Object(Illuminate\Queue\WorkerOptions))
#16 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(118): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\DatabaseJob), 'database', Object(Illuminate\Queue\WorkerOptions))
#17 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Console\WorkCommand.php(101): Illuminate\Queue\Worker->daemon('database', 'default', Object(Illuminate\Queue\WorkerOptions))
#18 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Queue\Console\WorkCommand.php(85): Illuminate\Queue\Console\WorkCommand->runWorker('database', 'default')
#19 [internal function]: Illuminate\Queue\Console\WorkCommand->handle()
#20 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(29): call_user_func_array(Array, Array)
#21 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#22 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#23 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Container\Container.php(564): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#24 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Console\Command.php(179): Illuminate\Container\Container->call(Array)
#25 D:\wamp64\www\kabza\vendor\symfony\console\Command\Command.php(255): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#26 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Console\Command.php(166): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#27 D:\wamp64\www\kabza\vendor\symfony\console\Application.php(886): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#28 D:\wamp64\www\kabza\vendor\symfony\console\Application.php(262): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#29 D:\wamp64\www\kabza\vendor\symfony\console\Application.php(145): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#30 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Console\Application.php(89): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#31 D:\wamp64\www\kabza\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(122): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#32 D:\wamp64\www\kabza\artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#33 {main}
"} 


My Jobs file looks like

<?php

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;

use League\Csv\Reader;
use League\Csv\Statement;

use App\Http\Service\KabzaService;
use App\Models\Colorado_voter;
use App\Models\Base_voter;

class StoreColorado implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    /**
     * Create a new job instance.
     *
     * @return void
     */

    private $service;
    private $table_name;
    private $dbase;

    public function __construct() {  
        $this->service = new KabzaService();
        $this->table = 'colorado_voter';
        $this->dbase = new Colorado_voter();
    }
 
    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        $offset = 0;
        $limit = 50;
        $filename = '1000.csv';

        $skip = array
        (
            8 => 1,
            25 => 1,
            26 => 1,
            27 => 1,
            31 => 1,
            44 => 1,
            49 => 1
        );
        $map_data = array
        (
            0 => 'voter_id',
            1 => 'voter_county_code',
            2 => 'voter_county',
            3 => 'name_last',
            4 => 'name_first',
            5 => 'name_middle',
            6 => 'name_suffix',
            7 => 'name_voter',
            8 => 'id',
            9 => 'voter_precinct_name',
            10 => 'voter_library_id',
            11 => 'home_house_number',
            12 => 'home_house_suffix',
            13 => 'home_direction',
            14 => 'home_street_name',
            15 => 'home_street_type',
            16 => 'home_direction',
            17 => 'home_unit_type',
            18 => 'home_unit_number',
            19 => 'home_street_address_1',
            20 => 'home_address_city',
            21 => 'home_address_state',
            22 => 'home_address_zip',
            23 => 'home_address_zip_plus',
            24 => 'home_address_effective_date',
            25 => 'id',
            26 => 'id',
            27 => 'id',
            28 => 'birth_year',
            29 => 'gender',
            30 => 'voter_precinct_name',
            31 => 'id',
            32 => 'voter_status_id',
            33 => 'voter_party',
            34 => 'voter_party_affiliation_date',
            35 => 'phone_preferred',
            36 => 'mailing_street_address_1',
            37 => 'mailing_street_address_2',
            38 => 'mailing_street_address_3',
            39 => 'mailing_address_city',
            40 => 'mailing_address_state',
            41 => 'mailing_address_zip',
            42 => 'mailing_address_zip_plus',
            43 => 'mailing_address_country',
            44 => 'id',
            45 => 'permanent_mail_in_voter',
            46 => 'voter_congressional_district',
            47 => 'voter_state_district',
            48 => 'voter_house_district',
            49 => 'id'
        );

        $db_header_obj = new Colorado_voter();
        $db_header = $db_header_obj->getTableColumns();

        $base_voter_header = new Base_voter();
        $base_voter_columns = $base_voter_header->getTableColumns();

        $csv_file_path = storage_path('app/files/colorado_voter/').$filename;
        if (!ini_get("auto_detect_line_endings")) {
            ini_set("auto_detect_line_endings", TRUE);
        }
        $csv = Reader::createFromPath($csv_file_path, 'r');

        $csv->setOutputBOM(Reader::BOM_UTF8);
        $csv->addStreamFilter('convert.iconv.ISO-8859-15/UTF-8');

            $csv->setHeaderOffset(0); //set the CSV header offset
            $csv_header = $csv->getHeader();    

            $rec_arr = array();
            $records = array();
            $records_arr = array();

            $stmt = (new Statement())
            ->offset($offset)
            ->limit($limit)
            ;

            $records = $stmt->process($csv);

            foreach ($records as $record) 
            {
                $rec_arr[] = array_values($record);
            }

            $records_arr = $this->service->trimArray($rec_arr);

            print_r($records_arr);

            if (!ini_get("auto_detect_line_endings")) {
                ini_set("auto_detect_line_endings", FALSE);
            }
        }


}

I am using CSV league to parse csv file. Those skip and map_data are just the array which will be used later to map which column from csv to which column in database and skip will be used to skip some columns.

01 Nov
3 months ago

ssquare left a reply on Cannot Insert Duplicate Key Row In Object 'dbo.student' With Unique Index 'dept_id_room_id_roll_id_unique'. The Duplicate Key Value Is (<NULL>, <NULL>, <NULL>)

Isn't there any other way? I think it might lead to another confusion during update. Such as update where roll_ id = $roll_id .

ssquare started a new conversation Cannot Insert Duplicate Key Row In Object 'dbo.student' With Unique Index 'dept_id_room_id_roll_id_unique'. The Duplicate Key Value Is (<NULL>, <NULL>, <NULL>)

I have created migration as

            $table->bigInteger('dept_id')->unsigned()->nullable(); 
            $table->bigInteger('room_id')->unsigned()->nullable(); 
            $table->bigInteger('roll_id')->unsigned()->nullable();
            $table->unique(['dept_id', 'room_id','roll_id']);

I am using MsSQL 2017 as the database. It is now allowing to have null value in these unique columns for more than once. What I am missing?

ssquare started a new conversation Data Missing ERROR!!

I am trying to insert data to the table as follows:

FEC::create($fec_arr);

dd($fec_arr) returns

array:22 [
  "cmte_id" => "C00343863"
  "amndt_ind" => "N"
  "rpt_tp" => "Q3"
  "transaction_pgi" => "P"
  "image_num" => "27990795810"
  "transaction_tp" => "15"
  "entity_tp" => "IND"
  "name_voter" => "HOETGER, JACQUELINE Middle_ini Midlle mr."
  "mailing_address_city" => "FENTON"
  "mailing_address_state" => "MI"
  "mailing_address_zip" => "48430"
  "employer" => "SELF"
  "occupation" => "MOTT MEDIA"
  "donation_date" => "2007-08-30 12:00:00"
  "donation_id" => "A-C39094"
  "fec_federal_num" => "307489"
  "fec_memo_cd" => ""
  "fec_memo_text" => ""
  "fec_sub_id" => "4.10E+18"
  "name_last" => "HOETGER"
  "base_voter_id" => 5
  "created_by" => 1
]

Columns List in FEC Modal

       [cmte_id]
      ,[amndt_ind]
      ,[rpt_tp]
      ,[transaction_pgi]
      ,[image_num]
      ,[transaction_tp]
      ,[entity_tp]
      ,[name_last]
      ,[name_voter]
      ,[mailing_address_city]
      ,[mailing_address_state]
      ,[mailing_address_zip]
      ,[employer]
      ,[occupation]
      ,[donation_date]
      ,[donation_amount]
      ,[donation_id]
      ,[fec_other_id]
      ,[fec_federal_num]
      ,[fec_memo_cd]
      ,[fec_memo_text]
      ,[fec_sub_id]
      ,[base_voter_id]
      ,[created_by]
      ,[updated_by]
      ,[deleted_at]
      ,[created_at]
      ,[updated_at]

I am getting error as Data Missing. What I am doing wrong here?

23 Oct
3 months ago

ssquare left a reply on Laravel Execute Stored Procedure Taking More Time Than From SSMS

An invalid statement option was specified.

        $dbh = DB::connection()->getPdo();
        $sth = $dbh->prepare("EXEC [spBaseVoterIndex] ?,?,?,?",[$order, $dir, (int)$pagenum, (int)$pagesize]);
        $posts  = $sth->execute();

Also, I have already used NOCOUNT ON on stored procedure, should I used here too or can i igonre here if I have included it on stored procedure

ssquare started a new conversation Laravel Execute Stored Procedure Taking More Time Than From SSMS

I am using laravel 5.6 and MSSQL as database. I have table with records more than 100m+ rows. So whenever I execute a stored procedure through SSMS it takes around 1 sec but if I execute it through laravel execute it, this query time increases by 7-8 times.

My laravel code here looks like:


        $time_start2 = microtime(true);

        $posts = DB::select('EXEC [spBaseVoterIndex] ?,?,?,?',
                [
                    $order, $dir, (int)$pagenum, (int)$pagesize
                ]);
        
        $time_end2 = microtime(true);
        $execution_time2 = $time_end2 - $time_start2;

Is there any way to know what is Laravel doing it in the back or could anyone explain about the background stuffs included here. What might be taking the time and how can I minimize it.

17 Oct
4 months ago

ssquare left a reply on Laravel Queue Not Working As Expected

@d9705996 I am using laravel 5.6

ssquare started a new conversation Laravel Queue Not Working As Expected

What I have done so far:

  1. Updated queue driver to database in .env
  2. My mail controller function looks like:
    public function sendEmail()
    {
       $emailJob = (new SendEmailJob())->delay(Carbon::now()->addSeconds(3));
       dispatch($emailJob);
        exit();
    }
  1. SendEmailJob handle
    public function handle()
    {
        Mail::to('[email protected]')->send(new SendMailable());
        echo 'email sent';
    }
  1. SendMailable Mail has following
    public function build()
    {
        return $this->view('emails.ownership');
    }

I want to send mail almost instantly after hitting the url. As I am running php artisan queue:listen with delay of 3 seconds it takes a lot of time before any action. I can see some data on jobs table with 0 attempts.

After long time, following error popup in command window

   Symfony\Component\Process\Exception\ProcessTimedOutException  : The process ""C:\wamp64\bin\php\php7.2.10\php.exe" "artisan" queue:work  --once --queue="default" --delay=0 --memory=128 --sleep=3 --tries=0" e
xceeded the timeout of 60 seconds.

  at C:\wamp64\www\project\vendor\symfony\process\Process.php:1154
    1150|
    1151|         if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
    1152|             $this->stop(0);
    1153|
  > 1154|             throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_GENERAL);
    1155|         }
    1156|
    1157|         if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) {
    1158|             $this->stop(0);

  Exception trace:

  1   Symfony\Component\Process\Process::checkTimeout()
      C:\wamp64\www\project\vendor\symfony\process\Process.php:383

  2   Symfony\Component\Process\Process::wait()
      C:\wamp64\www\project\vendor\symfony\process\Process.php:202

By, the way mail can be sent directly without this queue stuff. Also, is this compulsory to run php artisan queue:listen? How am I supposed to run this in server with no shell access?

11 Oct
4 months ago

ssquare started a new conversation Catch Error If Arise On A Loop But Continue Ro Process Other Data From The Loop.

Scenarion:

I am trying to dump data from csv file to MsSQL database. My code is as:

        /*here skip is just 0 or 1 if skip is 0 later that mapped row will be ignored. Map data contains index array which will later used to map csv column to database column*/

        $limit = $this->service->getSettingsNameValue('chunk_limit');
            $skip = $request->skip;
            $map_data = $request->row;

    /*Just reading csv file. Have used csv league*/
        $db_header_obj = new Sos_contribution();
            $db_header = $db_header_obj->getTableColumns();
            $csv_file_path = storage_path('app/files/sos_contribution/').$request->filename;
            $csv = Reader::createFromPath($csv_file_path, 'r');
            $csv->setOutputBOM(Reader::BOM_UTF8);
            $csv->addStreamFilter('convert.iconv.ISO-8859-15/UTF-8');
            $csv->setHeaderOffset(0); //set the CSV header offset
            $csv_header = $csv->getHeader();    

            $rec_arr = array();
            $records = array();
            $records_arr = array();

            $stmt = (new Statement())
            ->offset($offset)
            ->limit($limit)
            ;

            $records = $stmt->process($csv);

            foreach ($records as $record) 
            {
                $rec_arr[] = array_values($record);
            }

            $records_arr = $this->service->trimArray($rec_arr);

            if(count($records_arr)>0)
            {
                foreach($records_arr as $ck => $cv){

                    $sos_contribution_arr = array();
                    foreach ($map_data as $mk => $mv) {
                        if(!isset($skip[$mk])){

                                $data_type = $this->service->getDatabaseColumnType($this->table,$mv);
                                if($data_type == 'date' || $data_type == 'datetime' || $data_type == 'timestamp'){
                /*just little piece of formatting of datetime*/
                                    $datetime =  (array)$cv[$mk];
                                    $dt = array_shift($datetime);
                                    $dt = date('Y-m-d h:i:s', strtotime($dt));
                                    $sos_contribution_arr[$mv] = $dt;
                                }else{
                                    $sos_contribution_arr[$mv] = $cv[$mk];
                                }   

                        }
                    }


        /*CATCH ERROR HERE*/
                    Sos_contribution::where('voter_state_id',$sos_contribution_arr['voter_state_id'])
                        ->update($sos_contribution_arr);

                   
              }
        }

Problem:

As I have huge csv file, there might be some typo errors in some column for example here example having some string character in integer column.

So, for example if there are 10 rows and there is an sql error for row 2. this means there is an string character mapped to int column. In that case, it just throws error and halt the process.

But, what I want is not to halt the process, instead record the row number and continuing other row. In this case, store 2 in a variable and continue processing 3-10 and later return that row number.

Is that possible?

What might be the best way to deal with this as later I want to queue this job and later send email to the owner after the completion of job with failed row number.

Example error: SQLSTATE[22018]: [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Conversion failed when converting the nvarchar value 'abx' to data type tinyint.

24 Sep
4 months ago

ssquare started a new conversation Obtain Result In Object Type And In Single Level

My MSSQL procedure

CREATE PROCEDURE PROCEDURE_NAME
AS BEGIN
    SELECT COUNT(*) FROM users
END

Currently calling as $totalData = DB::select('EXEC PROCEDURE_NAME');

and getting result in

<pre>Array
(
    [0] => stdClass Object
        (
            [] => 200000
        )

)
</pre>

Instead of this how can I get 200000 directly in $totalData.

21 Sep
4 months ago

ssquare started a new conversation Introducing FOREIGN KEY Constraint 'my_list_user_user_id_foreign' On Table 'my_l Ist_user' May Cause Cycles Or Multiple Cascade Paths. Specify ON DELETE NO ACTION Or ON UPDATE NO ACTION, Or Modify Other FOREIGN KEY Constraints.

I have just moved from mysql to MSSQL server. But, if I try to run migration I received error as follows. [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Introducing FOREIGN KEY constraint 'my_list_user_user_id_foreign' on table 'my_l ist_user' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints. (SQL: alter table "my_list_user" add constrai nt "my_list_user_user_id_foreign" foreign key ("user_id") references "users" ("id") on delete cascade)

My migration schema looks lie belows

Users

        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('email')->unique();
            $table->string('password');
            $table->integer('organization_id')->unsigned();
            $table->foreign('organization_id')->references('id')->on('organizations');
            $table->rememberToken();
            $table->softDeletes();
            $table->timestamps();
        });

My_Lists

        Schema::create('my_lists', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title',255); 
            $table->text('description'); 

            $table->unsignedInteger('created_by');
            $table->foreign('created_by')->references('id')->on('users')->onDelete('cascade');

            $table->softDeletes();
            $table->timestamps();
        });

My_list_user

        Schema::create('my_list_user', function (Blueprint $table) {
            $table->integer('my_list_id')->unsigned()->index();
            $table->foreign('my_list_id')->references('id')->on('my_lists')->onDelete('cascade');


            $table->integer('user_id')->unsigned()->index();
            $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
            $table->primary(['my_list_id', 'user_id']); 
         });

Is that MS SQL does not support even a single level of cascade? How can I solve this?

ssquare left a reply on SQLSTATE[08001]: [Microsoft][ODBC Driver 13 For SQL Server]TCP Provider: No Connection Could Be Made Because The Target Machine Actively Refused It. (SQL: Select Top 1 * From [settings] Where [name] = Site_title And [settings].[deleted_at] Is Null)

Thank you actually I need to make change to SQL server authentication. That is the key what I am missing. Also, as you suggest I need to place drive on both ext folder.

ssquare left a reply on SQLSTATE[08001]: [Microsoft][ODBC Driver 13 For SQL Server]TCP Provider: No Connection Could Be Made Because The Target Machine Actively Refused It. (SQL: Select Top 1 * From [settings] Where [name] = Site_title And [settings].[deleted_at] Is Null)

@staudenmeir I have an update now. If I test with following code.

<?php
$serverName = "(local)";
$connectionInfo = array( "Database"=>"kpi_db","UID"=>"root", "PWD"=>"123456");
$conn = sqlsrv_connect( $serverName, $connectionInfo);

if( $conn ) {
     echo "Connection established.<br />";
}else{
     echo "Connection could not be established.<br />";
     die( print_r( sqlsrv_errors(), true));
}
?>`

It shows following error

Connection could not be established. Array ( [0] => Array ( [0] => 28000 [SQLSTATE] => 28000 [1] => 18456 [code] => 18456 [2] => [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Login failed for user 'root'. [message] => [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Login failed for user 'root'. ) [1] => Array ( [0] => 28000 [SQLSTATE] => 28000 [1] => 18456 [code] => 18456 [2] => [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Login failed for user 'root'. [message] => [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Login failed for user 'root'. ) )

But if I tried with

<?php
$serverName = "DESKTOP-H9OGJE5\MSSQLSERVER";
$connectionInfo = array( "Database"=>"kpi_db","UID"=>"root", "PWD"=>"123456");
$conn = sqlsrv_connect( $serverName, $connectionInfo);

if( $conn ) {
     echo "Connection established.<br />";
}else{
     echo "Connection could not be established.<br />";
     die( print_r( sqlsrv_errors(), true));
}
?>`

I used to got different error Connection could not be established. Array ( [0] => Array ( [0] => 08001 [SQLSTATE] => 08001 [1] => 87 [code] => 87 [2] => [Microsoft][ODBC Driver 13 for SQL Server]SQL Server Network Interfaces: Connection string is not valid [87]. [message] => [Microsoft][ODBC Driver 13 for SQL Server]SQL Server Network Interfaces: Connection string is not valid [87]. ) [1] => Array ( [0] => HYT00 [SQLSTATE] => HYT00 [1] => 0 [code] => 0 [2] => [Microsoft][ODBC Driver 13 for SQL Server]Login timeout expired [message] => [Microsoft][ODBC Driver 13 for SQL Server]Login timeout expired ) [2] => Array ( [0] => 08001 [SQLSTATE] => 08001 [1] => 87 [code] => 87 [2] => [Microsoft][ODBC Driver 13 for SQL Server]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. [message] => [Microsoft][ODBC Driver 13 for SQL Server]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. ) )

Could you get some clue?

ssquare left a reply on SQLSTATE[08001]: [Microsoft][ODBC Driver 13 For SQL Server]TCP Provider: No Connection Could Be Made Because The Target Machine Actively Refused It. (SQL: Select Top 1 * From [settings] Where [name] = Site_title And [settings].[deleted_at] Is Null)

@staidenmeir

DB_CONNECTION=sqlsrv
DB_HOST=DESKTOP-H9OGJE5\MSSQLSERVER
DB_PORT=1433
DB_DATABASE=kpi_db
DB_USERNAME=root
DB_PASSWORD=123456

and

DB_CONNECTION=sqlsrv
DB_HOST=DESKTOP-H9OGJE5\MSSQLSERVER
DB_PORT=1433
DB_DATABASE=kpi_db
DB_USERNAME=sa
DB_PASSWORD=

I have checked with both of this combination and with user root and sa both times gives same result for with port it also shows port and if no port provided it won't display port

ssquare left a reply on SQLSTATE[08001]: [Microsoft][ODBC Driver 13 For SQL Server]TCP Provider: No Connection Could Be Made Because The Target Machine Actively Refused It. (SQL: Select Top 1 * From [settings] Where [name] = Site_title And [settings].[deleted_at] Is Null)

@staudenmeir I have worked with that too. But with no success. Still returning.

"sqlsrv:Server=DESKTOP-H9OGJE5\MSSQLSERVER;Database=kpi_db"

If you could, I could also screen share with team viewer or so

ssquare left a reply on SQLSTATE[08001]: [Microsoft][ODBC Driver 13 For SQL Server]TCP Provider: No Connection Could Be Made Because The Target Machine Actively Refused It. (SQL: Select Top 1 * From [settings] Where [name] = Site_title And [settings].[deleted_at] Is Null)

@staudenmeir

APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:MQ/MXLKOABVwvWjD3G9TgX1v4BO/+bWCez06cuzhYv8=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack

DB_CONNECTION=sqlsrv
DB_HOST=DESKTOP-H9OGJE5\MSSQLSERVER
DB_PORT=1433
DB_DATABASE=kpi_db
DB_USERNAME=sa
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=120
QUEUE_DRIVER=database

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.sendgrid.net
MAIL_PORT=587
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=tls

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

ssquare left a reply on SQLSTATE[08001]: [Microsoft][ODBC Driver 13 For SQL Server]TCP Provider: No Connection Could Be Made Because The Target Machine Actively Refused It. (SQL: Select Top 1 * From [settings] Where [name] = Site_title And [settings].[deleted_at] Is Null)

@technosml ```$serverName = "DESKTOP-H9OGJE5\MSSQLSERVER"; //serverName\instanceName $connectionInfo = array( "Database"=>"kpi_db", "UID"=>"sa", "PWD"=>""); $conn = sqlsrv_connect( $serverName, $connectionInfo); if( $conn ) { echo "Connection established. "; }else{ echo "Connection could not be established. "; die( print_r( sqlsrv_errors(), true)); } ?>`


I got above error. I have created database on sql server using (local). And I don't know I have which username and password on sqlserver I am using username 'sa' and black password as suggesting as default one.

ssquare left a reply on SQLSTATE[08001]: [Microsoft][ODBC Driver 13 For SQL Server]TCP Provider: No Connection Could Be Made Because The Target Machine Actively Refused It. (SQL: Select Top 1 * From [settings] Where [name] = Site_title And [settings].[deleted_at] Is Null)

@staudenmeir Got following error

SQLSTATE[08001]: [Microsoft][ODBC Driver 13 for SQL Server]SQL Server Network Interfaces: Connection string is not valid [87]. (SQL: select top 1 * from [settings] where [name] = site_title and [settings].[deleted_at] is null)

ssquare started a new conversation SQLSTATE[08001]: [Microsoft][ODBC Driver 13 For SQL Server]TCP Provider: No Connection Could Be Made Because The Target Machine Actively Refused It. (SQL: Select Top 1 * From [settings] Where [name] = Site_title And [settings].[deleted_at] Is Null)

I am just trying to migrate my laravel to sql server. I have installed Miscrosoft SQL Server. I have downloaded SQL server developer version and make default basic installation.

I am using wamp 64 with php 7.2.4. I have added two extensions in php.ini after I copied them inside wamp64/bin/php/php7.2.4/ext/

extension=php_pdo_sqlsrv_72_ts_x64 extension=php_sqlsrv_72_ts_x64

Now, I can see pdo_sqlsrv in phpinfo.

I have created a database in MSSQL and updated .env file as

DB_CONNECTION=sqlsrv
DB_HOST=DESKTOP-H9OGJE5\MSSQLSERVER
DB_PORT=1433
DB_DATABASE=kpi_db
DB_USERNAME=sa
DB_PASSWORD=

But, unfortunately I am getting this error when I tried to load. Also, I have tried to migrate through artisan command but with no success

   Illuminate\Database\QueryException  : could not find driver (SQL: select * from sysobjects where type = 'U' and name = migrations)

  at C:\wamp64\www\project\vendor\laravel\framework\src\Illuminate\Database\Connection.php:664
    660|         // If an exception occurs when attempting to run a query, we'll format the error
    661|         // message to include the bindings with SQL, which will make this exception a
    662|         // lot more helpful to the developer instead of just the database's errors.
    663|         catch (Exception $e) {
  > 664|             throw new QueryException(
    665|                 $query, $this->prepareBindings($bindings), $e
    666|             );
    667|         }
    668|

  Exception trace:

  1   Doctrine\DBAL\Driver\PDOException::("could not find driver")
      C:\wamp64\www\project\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOConnection.php:50

  2   PDOException::("could not find driver")
      C:\wamp64\www\project\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOConnection.php:46

  Please use the argument -v to see more details.

13 Sep
5 months ago

ssquare started a new conversation Jquery Datatable Throws Error As Soon As I Implement Laravel Pagination Links

@foreach($users as $kv => $vv)
                                    <tr>
                                        <td>{{ $vv -> name}}</td>
                                        <td>{{ $vv-> address}}</td>
                                        <td>{{ city }}</td>
                                        <td> Actions </td>
                                    </tr>
                                    @endforeach
                                    <tr>
                                        <td colspan="100%"> 
                                            {{ $users->links() }}
                                        </td>
                                    </tr>

Error: Cannot set property '_DT_CellIndex' of undefined

After this error, it also does not show datatable's search, sorting and filtering. But as soon as I remove {{$users -> links }} everything works fine.

What I am trying?

I am trying to implement laravel pagination with jquery datatables. As, even serverside jquery datatables took quite long time to process around 30M data. Is there any way to use laravel pagination but jquery datatable's sort, search, and filter?

Any suggestion will be appreciated.

29 Aug
5 months ago

ssquare started a new conversation Create A New Table Or Store In Same

Ok, I have data about different persons. Lets' say people from different states. One states have around 10-15M rows of data. Now, here which one is suitable is it good to make each table for each state or to insert all data in same table.

Could you also explain me the pros and cons of both method.

24 Aug
5 months ago

ssquare left a reply on Malformed UTF-8 Characters, Possibly Incorrectly Encoded

Ok, I have fixed this. Instead of fixing before inserting to database. I convert the charset during reading csv file. So, after that, even on beginning

Dummy Name �zilhis was replaced to Özil

ssquare left a reply on Malformed UTF-8 Characters, Possibly Incorrectly Encoded

@sirik Yeah, that's my exact requirement. But unfortunately, this also doe snot work.

I have tried to print.

{
         p($cv[$mk]);
        $contribution_data_arr[$mv] = preg_replace("/&([a-z])[a-z]+;/i", "", htmlentities($cv{$mk}));;
}
p($contribution_data_arr);

Here before preg_replace: Dummy Name �zilfter replace:

Array
(
    [name] =>              //Actually here needs to be displayed Ozil
    [home_street_address_1] => YUMA STREET
)
23 Aug
5 months ago

ssquare left a reply on Malformed UTF-8 Characters, Possibly Incorrectly Encoded

@Sirik Your solutions work with error but Instead It is replacing "Özil" to "zil". This is not what I am seeking.

ssquare left a reply on Malformed UTF-8 Characters, Possibly Incorrectly Encoded

@tray I am currently using 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci'. Instead of changing, is not there any way to encode it and decode it later querying from database.