where('name','新杰物流到付')->first(); if(!$logistic){ \App\Logistic::query()->create(['name'=>'新杰物流到付','code'=>'XJWLDF']); } } /** * Reverse the migrations. * * @return void */ public function down() { // \App\Logistic::query()->where('code','XJWLDF')->delete(); } }