在Laravel 4块中保存不起作用

I am updating models inside Larave 4 chunk method, but half of models is not beeing updating. Looks like after process only half of records it stops, but I dont understand why, I tried to change chunk size and total size of records. If I have 1522 records it processes only 800, if I have 722 total it processes only 400..

        Books::whereNull($slugField)->chunk(100, function (Collection $entries) {
            foreach ($entries as $entry) {
                $entry->slug = 'test';
                $entry->save();
            }
        });

Any ideas? thanks

you only saving records where $slugfield has null.so only null fields of $slug Field are saving..

If you want to save all Records then use

Books::chunk(100, function (Collection $entries) {
            foreach ($entries as $entry) {
                $entry->slug = 'test';
                $entry->save();
            }
        });