I'm guessing you don't have slugs set on older DB entries yet. Try creating a script that will loop through all of them, adding the slug value, which you probably get from the title.
I don't know the plugin, but Laravel already has support for that.
Str::slug($post->title, '-')
You should probably check that you don't get duplicate values.
i think eloquent updating might not work if you have set a validation rule 'unique' for one or more of fields
if that, you should rewrite rules before updating to be: either remove unique rules or add unique exception id as the third argument for unique rule
assume your validation rules like this
$rules = array(
'name' => 'required|unique:test_table,test_column'
);
// while updating assume name doesn't changed and other fields has changed
// since name is unique, eloquent will query if test_column in test_table has the value of name
// since it's already exists while updating, validation will fails so updating fails
// so before updating you should rewrite validation rules to be either
$rules = array(
'name' => 'required' // By Removing Unique rule
);
// or
$rules = array(
'name' => 'required|unique:test_table,test_column,id' // or by adding current model id to be as exception for unique rule
);
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community