Luís Novais
07/15/2021, 9:13 PMifox
07/15/2021, 9:15 PMifox
07/15/2021, 9:18 PMifox
07/15/2021, 9:18 PMLuís Novais
07/15/2021, 9:19 PMifox
07/15/2021, 9:20 PMLuís Novais
07/15/2021, 9:21 PMpboivin
07/15/2021, 9:25 PMfalse
. Click it, then save. Got the same error.pboivin
07/15/2021, 9:25 PMLuís Novais
07/15/2021, 9:26 PMBibo
07/17/2021, 11:46 AMifox
07/17/2021, 11:51 AMifox
07/17/2021, 11:51 AMconfig('twill.slug_utf8_languages')
ifox
07/17/2021, 11:52 AMBibo
07/17/2021, 11:53 AMBibo
07/17/2021, 12:06 PMifox
07/17/2021, 12:27 PMconfig/twill.php
fileBibo
07/17/2021, 12:44 PMBibo
07/17/2021, 12:50 PMandrewsamuelhan
07/18/2021, 5:26 AMantonioribeiro
07/19/2021, 4:40 PMapp(PostsRepository::class)->update($post->id, $data);
And instead of just updating all fields on $data
variable the repository is actually deleting everything (translations, fields, blocks...), because, probably, it needs $data
to contain the whole model data (original + new). But to have that I would have to reconstruct what the CMS frontend send to the repository, which (I've been there) it's huge. Anyone did this differently here?pboivin
07/19/2021, 5:09 PMifox
07/19/2021, 5:15 PM$data
?antonioribeiro
07/19/2021, 5:22 PMantonioribeiro
07/19/2021, 5:24 PMpublic function updateOnly($id, $updateFields)
{
DB::transaction(function () use ($id, $updateFields) {
$object = $this->model->findOrFail($id);
$fields = $this->prepareFieldsBeforeSave($object, $updateFields);
$fields = $this->removeMissingFieldsFromUpdate(
$fields,
$updateFields,
);
$object->fill(Arr::except($fields, $this->getReservedFields()));
$object->save();
}, 3);
}
private function removeMissingFieldsFromUpdate(
array $fields,
$updateFields
): array {
$locales = locales();
$updateFields = collect($updateFields);
foreach ($fields as $name => $field) {
if ($updateFields->has($name)) {
continue;
}
if ($locales->contains($name)) {
$fields[$name] = $this->removeMissingFieldsFromUpdate(
$field,
$updateFields,
);
if (count($fields[$name]) === 0) {
unset($fields[$name]);
}
continue;
}
unset($fields[$name]);
}
return $fields;
}
This is very particular to my use case as it doesn't take in consideration blocks and other stuff, so we probably need a way better solution for thisvianney
07/19/2021, 5:41 PMphp artisan twill:dev
I use Docker/Laradock at the moment and it's not agreeing with my setup and was wondering what you guys use: Homestead?, Valet?, Docker?, etc.pboivin
07/19/2021, 6:02 PMvianney
07/19/2021, 6:04 PMpboivin
07/19/2021, 6:05 PMvianney
07/19/2021, 6:08 PM