Skip to content

Commit

Permalink
bug fix cms setting seeder
Browse files Browse the repository at this point in the history
  • Loading branch information
fherryfherry committed Mar 14, 2017
1 parent cdec3bb commit 241ad1c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/database/seeds/DatabaseSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,12 @@ public function run()
];

foreach($data as $row) {
if(DB::table('cms_settings')->where('name',$row['name'])->count()) {
$count = DB::table('cms_settings')->where('name',$row['name'])->count();
if($count) {
if($count > 1) {
$newsId = DB::table('cms_settings')->where('name',$row['name'])->orderby('id','asc')->take(1)->first();
DB::table('cms_settings')->where('name',$row['name'])->where('id','!=',$newsId->id)->delete();
}
continue;
}
$row['id'] = DB::table('cms_settings')->max('id') + 1;
Expand Down

0 comments on commit 241ad1c

Please sign in to comment.