123456789101112131415161718192021222324252627 |
- <?php
- namespace App;
- use Illuminate\Database\Eloquent\Model;
- class Dealer extends Model
- {
- protected $guarded = [];
- public function import($data, $info)
- {
- foreach ($data as $v) {
- if (!self::where('identifier', $v['identifier'])->count()) {
- self::firstOrCreate($v);
- }
- }
- return true;
- }
- public static function getOption()
- {
- $data = self::where('status', 1)->pluck('name', 'id')->toArray();
- return array_prepend($data, '暂无', 0);
- }
- }
|