diff --git a/formaters/pint.json b/formaters/pint.json index ed607b5f..fe12630a 100644 --- a/formaters/pint.json +++ b/formaters/pint.json @@ -9,7 +9,7 @@ }, "new_with_parentheses": { "named_class": true, - "anonymous_class": true + "anonymous_class": false }, "not_operator_with_successor_space": false, "nullable_type_declaration_for_default_null_value": { diff --git a/src/app/Console/Commands/OneRun/FillPhotoAndUrlInOneCProducts.php b/src/app/Console/Commands/OneRun/FillPhotoAndUrlInOneCProducts.php new file mode 100644 index 00000000..af936e8f --- /dev/null +++ b/src/app/Console/Commands/OneRun/FillPhotoAndUrlInOneCProducts.php @@ -0,0 +1,54 @@ +whereNotNull('one_c_id'); + + $bar = $this->output->createProgressBar($productsQuery->count()); + + $productsQuery + ->with(['category', 'productFromOneC', 'media']) + ->select(['id', 'one_c_id', 'slug', 'category_id']) + ->chunk(200, function (Collection $chunk) use ($bar) { + $chunk->each(function (Product $product) use ($bar) { + /** @var ProductFromOneC $productFromOneC */ + if ($productFromOneC = $product->productFromOneC) { + $productFromOneC->update([ + 'SP6111' => url($product->getUrl()), + 'SP6116' => $product->getFirstMediaUrl(conversionName: 'catalog'), + ]); + } + $bar->advance(); + }); + }); + + $bar->finish(); + $this->output->newLine(); + } +} diff --git a/src/app/Models/OneC/AbstractOneCModel.php b/src/app/Models/OneC/AbstractOneCModel.php index bfe76072..b4dbbcea 100644 --- a/src/app/Models/OneC/AbstractOneCModel.php +++ b/src/app/Models/OneC/AbstractOneCModel.php @@ -16,6 +16,20 @@ abstract class AbstractOneCModel extends Model */ protected $connection = 'sqlsrv'; + /** + * The primary key associated with the table. + * + * @var string + */ + protected $primaryKey = 'ROW_ID'; + + /** + * Indicates if the model should be timestamped. + * + * @var bool + */ + public $timestamps = false; + /** * Auto Trim Field From Database * diff --git a/src/app/Models/Stock.php b/src/app/Models/Stock.php index e5471900..1f9c83a4 100644 --- a/src/app/Models/Stock.php +++ b/src/app/Models/Stock.php @@ -24,8 +24,10 @@ * @property string $internal_name * @property string|null $description * @property string|null $address + * @property string|null $address_zip Индекс * @property string|null $worktime Рабочее время * @property string|null $phone + * @property string|null $contact_person Контактное лицо * @property bool $has_pickup * @property float|null $geo_latitude * @property float|null $geo_longitude diff --git a/src/app/Models/Url.php b/src/app/Models/Url.php index 4ca5fe47..d8993b58 100644 --- a/src/app/Models/Url.php +++ b/src/app/Models/Url.php @@ -49,7 +49,7 @@ public function filters() } /** - * Return ralation model + * Return relation model */ public function getFilterModel(): Model { diff --git a/src/app/Models/User/User.php b/src/app/Models/User/User.php index b974db71..125d9a9f 100644 --- a/src/app/Models/User/User.php +++ b/src/app/Models/User/User.php @@ -47,6 +47,9 @@ * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Orders\Order[] $orders * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Feedback[] $reviews * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Logs\SmsLog[] $mailings + * @property-read \App\Models\User\UserBlacklist|null $blacklist + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\User\UserBlacklist[] $blacklistLogs + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Payments\OnlinePayment[] $payments * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\User\UserPromocode[] $usedPromocodes * * @mixin \Illuminate\Database\Eloquent\Builder diff --git a/src/app/Models/User/UserBlacklist.php b/src/app/Models/User/UserBlacklist.php index b0d982d7..7a144089 100644 --- a/src/app/Models/User/UserBlacklist.php +++ b/src/app/Models/User/UserBlacklist.php @@ -8,7 +8,7 @@ /** * @property int $id - * @property int $user_id + * @property int $user_id ID пользователя * @property string|null $comment Комментарий * @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $updated_at diff --git a/src/config/model-doc.php b/src/config/model-doc.php index 0b0ba592..184995e5 100644 --- a/src/config/model-doc.php +++ b/src/config/model-doc.php @@ -50,6 +50,7 @@ // Ignore models by FQCN 'ignore' => [ \App\Models\OneC\OfflineOrder::class, + \App\Models\OneC\Product::class, ], 'custom_tags' => [