I have this function here:
我在这里有这个功能:
public function move() {
$prefs = DB::table('users')->select('id', 'Preferences')->where('Preferences', '!=', '')->get();
foreach ($prefs as $pref) {
$tags = $pref->Preferences;
$tag = explode(',', $tags);
foreach ($tag as $t) {
$new = DB::table('prefs')->select('id', 'tag')->where('tag', '=', $t)->get();
$taguser = new Tag(array(
'user_id' => $pref->id,
'tag_id' => $t,
'tagsid' => $new->id
));
$taguser->save(); //save in table
}
}
return view('refactor');
}
publ