public function toArray($request)
{
return [
'id' => $this->id,
'name' => $this->name,
'specialities' => SpecialityResource::collection($this->whenLoaded('activeSpecialities')),
];
}
public function toArray($request)
{
return [
'user' => UserResource::make($this->whenLoaded('user')),
'special_price' => $this->special_price,
];
}
скоро возникнет ситуация переполнения
md5() от category_id, articul
использовать оба поля для связи (
where tmp_id between 400000 and 400100
- в вашем случае вероятно не подойдет.const data = [1, 2, 3, 4, 5, 6, 7, 8, 9];
const chunks = 3;
function delay(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
let promise = Promise.resolve();
for (let i = 0; i < data.length; i += chunks) {
const slice = data.slice(i, i + chunks);
promise = promise.then(() => Promise.all(
slice.map(() => console.log(i))
));
}
promise.then(() => console.log('all done'));