'json']; /** * The attributes excluded from the model's JSON form. * * @var array */ protected $hidden = []; public function admin() { return $this->belongsTo(Admin::class)->select(['id', 'username', 'name']); } /** * 创建导入任务 * @param $resource * @param $type * @param $admin_id * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model */ public static function importTask($resource, $type, $admin_id) { return self::query()->updateOrCreate([ 'resource_id' => $resource['id'], 'type' => $type, 'admin_id' => $admin_id, ], [ 'name' => $resource['original_name'], 'type_id' => 0, 'make_status' => TaskMakeStatusEnum::WAIT, ]); } }